aiogram/aiogram/methods
Alex Root Junior cd4e811856
Refactor: Introduce Union types for streamlined type handling (#1649)
* Refactor: Introduce Union types for streamlined type handling

Implemented Union types across various modules to consolidate and simplify type annotations. This change replaces repetitive union declarations with reusable Union aliases, improving code readability and maintainability. Updates applied to affected classes, methods, and imports accordingly.

* Refactor unions into type aliases for better reusability

Replaced inline `Union` types with predefined aliases like `MediaUnion`, `ReplyMarkupUnion`, and `ChatIdUnion`. Simplifies type annotations, improves code readability, and reduces duplication. Added `media_union.py` for grouping related media types.

* Refactor type unions with ResultChatMemberUnion and ResultMenuButtonUnion

Replaced verbose type definitions of chat member and menu button unions with `ResultChatMemberUnion` and `ResultMenuButtonUnion` for improved readability and maintainability. Updated relevant methods, modules, and documentation to use the new type aliases consistently.

* Added changelog
2025-03-08 02:19:57 +02:00
..
__init__.py Added full support of Bot API 8.2 (#1623) 2025-01-02 02:38:18 +02:00
add_sticker_to_set.py Added full support of Bot API 7.2 (#1444) 2024-04-22 13:48:49 +03:00
answer_callback_query.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
answer_inline_query.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
answer_pre_checkout_query.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
answer_shipping_query.py Added full support for the Bot API 8.3 (#1638) 2025-02-16 22:37:18 +02:00
answer_web_app_query.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
approve_chat_join_request.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
ban_chat_member.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
ban_chat_sender_chat.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
base.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
close.py Update pydantic to V2 (#1202) 2023-07-02 15:07:19 +03:00
close_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
close_general_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
copy_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
copy_messages.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
create_chat_invite_link.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
create_chat_subscription_invite_link.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
create_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
create_invoice_link.py Added full support of Bot API 8.1 (#1617) 2024-12-14 19:30:12 +02:00
create_new_sticker_set.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
decline_chat_join_request.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_chat_photo.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_chat_sticker_set.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_messages.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_my_commands.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
delete_sticker_from_set.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
delete_sticker_set.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
delete_webhook.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
edit_chat_invite_link.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_chat_subscription_invite_link.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_general_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_message_caption.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_message_live_location.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_message_media.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_message_reply_markup.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_message_text.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
edit_user_star_subscription.py Added full support for Bot API 8.0 (#1606) 2024-11-17 23:18:42 +02:00
export_chat_invite_link.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
forward_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
forward_messages.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_available_gifts.py Added full support for the Bot API 8.3 (#1638) 2025-02-16 22:37:18 +02:00
get_business_connection.py Added full support of Bot API 7.2 (#1444) 2024-04-22 13:48:49 +03:00
get_chat.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_chat_administrators.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_chat_member.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_chat_member_count.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_chat_menu_button.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_custom_emoji_stickers.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
get_file.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_forum_topic_icon_stickers.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
get_game_high_scores.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
get_me.py Update pydantic to V2 (#1202) 2023-07-02 15:07:19 +03:00
get_my_commands.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_my_default_administrator_rights.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_my_description.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_my_name.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_my_short_description.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_star_transactions.py Added full support of Bot API 7.5 (#1518) 2024-06-19 00:54:22 +03:00
get_sticker_set.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_updates.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
get_user_chat_boosts.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
get_user_profile_photos.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
get_webhook_info.py Update pydantic to V2 (#1202) 2023-07-02 15:07:19 +03:00
hide_general_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
leave_chat.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
log_out.py Update pydantic to V2 (#1202) 2023-07-02 15:07:19 +03:00
pin_chat_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
promote_chat_member.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
refund_star_payment.py Added full support of Bot API 7.4 (#1498) 2024-05-31 20:07:11 +03:00
remove_chat_verification.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
remove_user_verification.py Added full support for the Bot API 8.3 (#1638) 2025-02-16 22:37:18 +02:00
reopen_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
reopen_general_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
replace_sticker_in_set.py Added full support of Bot API 7.2 (#1444) 2024-04-22 13:48:49 +03:00
restrict_chat_member.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
revoke_chat_invite_link.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
save_prepared_inline_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_animation.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_audio.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_chat_action.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_contact.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_dice.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_document.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_game.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
send_gift.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_invoice.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_location.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_media_group.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_paid_media.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_photo.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_poll.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_sticker.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_venue.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_video.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_video_note.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
send_voice.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_administrator_custom_title.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_description.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_menu_button.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_permissions.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_photo.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_sticker_set.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_chat_title.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_custom_emoji_sticker_set_thumbnail.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_game_score.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_message_reaction.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_my_commands.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_my_default_administrator_rights.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_my_description.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_my_name.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_my_short_description.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_passport_data_errors.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_sticker_emoji_list.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
set_sticker_keywords.py Added full support of Bot API 7.11 (#1601) 2024-11-02 16:13:45 +02:00
set_sticker_mask_position.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_sticker_position_in_set.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_sticker_set_thumbnail.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_sticker_set_title.py Added typehints for init methods of types and methods (#1245) 2023-08-04 00:30:27 +03:00
set_user_emoji_status.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
set_webhook.py Added full support of Bot API 8.2 (#1623) 2025-01-02 02:38:18 +02:00
stop_message_live_location.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
stop_poll.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unban_chat_member.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unban_chat_sender_chat.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unhide_general_forum_topic.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unpin_all_chat_messages.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unpin_all_forum_topic_messages.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unpin_all_general_forum_topic_messages.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
unpin_chat_message.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
upload_sticker_file.py Added full support of Bot API 7.2 (#1444) 2024-04-22 13:48:49 +03:00
verify_chat.py Refactor: Introduce Union types for streamlined type handling (#1649) 2025-03-08 02:19:57 +02:00
verify_user.py Added full support for the Bot API 8.3 (#1638) 2025-02-16 22:37:18 +02:00