From 8f918215d2067ff8ef5b366d75d14c86f22b518a Mon Sep 17 00:00:00 2001 From: Seorgiy <44596276+seorgiy@users.noreply.github.com> Date: Sun, 24 Nov 2024 17:12:56 +0300 Subject: [PATCH] Upgrade to API 8.0 (#314) * implement Birthdays * Implement Bot API 7.10 * Implement Bot API 7.10 * Implement Bot API 7.10 * update endpoints for 7.10 * linter fix * Implement Bot API 7.11 * tests & changelog * minor fix for consistency * constrains fixed * clean up & constrains min/max/eq fixed & empty classes building * happy linter * Implement Bot API 8.0 * version & changelog * version correction --- CHANGELOG.md | 6 + Gemfile | 8 +- Rakefile | 45 - lib/telegram/bot/api/endpoints.rb | 14 +- lib/telegram/bot/exceptions/response_error.rb | 2 +- lib/telegram/bot/types/background_fill.rb | 16 + .../background_fill_freeform_gradient.rb | 12 + .../bot/types/background_fill_gradient.rb | 14 + .../bot/types/background_fill_solid.rb | 12 + lib/telegram/bot/types/background_type.rb | 17 + .../bot/types/background_type_chat_theme.rb | 12 + .../bot/types/background_type_fill.rb | 13 + .../bot/types/background_type_pattern.rb | 16 + .../bot/types/background_type_wallpaper.rb | 15 + lib/telegram/bot/types/birthdate.rb | 13 + lib/telegram/bot/types/bot_command.rb | 4 +- lib/telegram/bot/types/bot_command_scope.rb | 20 + lib/telegram/bot/types/business_connection.rb | 16 + lib/telegram/bot/types/business_intro.rb | 13 + lib/telegram/bot/types/business_location.rb | 12 + .../bot/types/business_messages_deleted.rb | 13 + .../bot/types/business_opening_hours.rb | 12 + .../types/business_opening_hours_interval.rb | 12 + lib/telegram/bot/types/chat.rb | 28 - .../bot/types/chat_administrator_rights.rb | 6 +- lib/telegram/bot/types/chat_background.rb | 11 + lib/telegram/bot/types/chat_boost_added.rb | 11 + lib/telegram/bot/types/chat_boost_source.rb | 5 +- .../bot/types/chat_boost_source_giveaway.rb | 1 + lib/telegram/bot/types/chat_full_info.rb | 54 + lib/telegram/bot/types/chat_invite_link.rb | 2 + lib/telegram/bot/types/chat_location.rb | 2 +- lib/telegram/bot/types/chat_member.rb | 8 +- .../bot/types/chat_member_administrator.rb | 6 +- lib/telegram/bot/types/chat_member_member.rb | 1 + lib/telegram/bot/types/chat_member_updated.rb | 1 + lib/telegram/bot/types/chat_shared.rb | 3 + lib/telegram/bot/types/copy_text_button.rb | 11 + lib/telegram/bot/types/error.rb | 14 + lib/telegram/bot/types/external_reply_info.rb | 1 + lib/telegram/bot/types/force_reply.rb | 4 +- lib/telegram/bot/types/gift.rb | 15 + lib/telegram/bot/types/gifts.rb | 11 + lib/telegram/bot/types/giveaway.rb | 1 + lib/telegram/bot/types/giveaway_completed.rb | 1 + lib/telegram/bot/types/giveaway_created.rb | 1 + lib/telegram/bot/types/giveaway_winners.rb | 1 + .../bot/types/inline_keyboard_button.rb | 3 +- lib/telegram/bot/types/inline_query_result.rb | 33 + .../types/inline_query_result_cached_gif.rb | 1 + .../inline_query_result_cached_mpeg4_gif.rb | 1 + .../types/inline_query_result_cached_photo.rb | 1 + .../types/inline_query_result_cached_video.rb | 1 + .../bot/types/inline_query_result_gif.rb | 3 +- .../types/inline_query_result_mpeg4_gif.rb | 3 +- .../bot/types/inline_query_result_photo.rb | 1 + .../bot/types/inline_query_result_video.rb | 1 + .../bot/types/inline_query_results_button.rb | 13 + .../types/input_contact_message_content.rb | 2 +- .../types/input_invoice_message_content.rb | 10 +- .../types/input_location_message_content.rb | 2 +- lib/telegram/bot/types/input_media.rb | 18 + .../bot/types/input_media_animation.rb | 1 + lib/telegram/bot/types/input_media_photo.rb | 1 + lib/telegram/bot/types/input_media_video.rb | 1 + .../bot/types/input_message_content.rb | 12 +- lib/telegram/bot/types/input_paid_media.rb | 15 + .../bot/types/input_paid_media_photo.rb | 12 + .../bot/types/input_paid_media_video.rb | 17 + lib/telegram/bot/types/input_poll_option.rb | 13 + lib/telegram/bot/types/input_sticker.rb | 15 + .../bot/types/input_text_message_content.rb | 4 +- .../bot/types/input_venue_message_content.rb | 2 +- .../bot/types/keyboard_button_request_chat.rb | 3 + .../types/keyboard_button_request_users.rb | 3 + lib/telegram/bot/types/location.rb | 2 +- .../bot/types/maybe_inaccessible_message.rb | 5 +- lib/telegram/bot/types/menu_button.rb | 16 + lib/telegram/bot/types/message.rb | 11 + lib/telegram/bot/types/message_origin.rb | 5 +- lib/telegram/bot/types/paid_media.rb | 16 + lib/telegram/bot/types/paid_media_info.rb | 12 + lib/telegram/bot/types/paid_media_photo.rb | 12 + lib/telegram/bot/types/paid_media_preview.rb | 14 + .../bot/types/paid_media_purchased.rb | 12 + lib/telegram/bot/types/paid_media_video.rb | 12 + .../bot/types/passport_element_error.rb | 22 + lib/telegram/bot/types/poll.rb | 3 +- lib/telegram/bot/types/poll_option.rb | 3 +- .../bot/types/prepared_inline_message.rb | 12 + lib/telegram/bot/types/reaction_type.rb | 8 +- lib/telegram/bot/types/reaction_type_paid.rb | 11 + lib/telegram/bot/types/refunded_payment.rb | 15 + .../bot/types/reply_keyboard_markup.rb | 4 +- .../bot/types/reply_keyboard_remove.rb | 2 +- lib/telegram/bot/types/response_parameters.rb | 12 + .../bot/types/revenue_withdrawal_state.rb | 16 + .../types/revenue_withdrawal_state_failed.rb | 11 + .../types/revenue_withdrawal_state_pending.rb | 11 + .../revenue_withdrawal_state_succeeded.rb | 13 + lib/telegram/bot/types/shared_user.rb | 15 + lib/telegram/bot/types/star_transaction.rb | 15 + lib/telegram/bot/types/star_transactions.rb | 11 + lib/telegram/bot/types/sticker_set.rb | 2 - lib/telegram/bot/types/story.rb | 5 +- lib/telegram/bot/types/successful_payment.rb | 3 + lib/telegram/bot/types/transaction_partner.rb | 18 + .../bot/types/transaction_partner_fragment.rb | 12 + .../bot/types/transaction_partner_other.rb | 11 + .../types/transaction_partner_telegram_ads.rb | 11 + .../types/transaction_partner_telegram_api.rb | 12 + .../bot/types/transaction_partner_user.rb | 17 + lib/telegram/bot/types/update.rb | 5 + lib/telegram/bot/types/user.rb | 2 + lib/telegram/bot/types/users_shared.rb | 2 +- lib/telegram/bot/version.rb | 2 +- rakelib/parse_schema.rake | 73 + rakelib/rebuild_types.rake | 90 + spec/lib/telegram/bot/types_spec.rb | 84 +- spec/support/type_attributes.yml | 3278 ----------- utility/empty_type.erb | 14 + utility/type.erb | 13 + utility/type_attributes.json | 5138 +++++++++++++++++ 123 files changed, 6325 insertions(+), 3476 deletions(-) create mode 100644 lib/telegram/bot/types/background_fill.rb create mode 100644 lib/telegram/bot/types/background_fill_freeform_gradient.rb create mode 100644 lib/telegram/bot/types/background_fill_gradient.rb create mode 100644 lib/telegram/bot/types/background_fill_solid.rb create mode 100644 lib/telegram/bot/types/background_type.rb create mode 100644 lib/telegram/bot/types/background_type_chat_theme.rb create mode 100644 lib/telegram/bot/types/background_type_fill.rb create mode 100644 lib/telegram/bot/types/background_type_pattern.rb create mode 100644 lib/telegram/bot/types/background_type_wallpaper.rb create mode 100644 lib/telegram/bot/types/birthdate.rb create mode 100644 lib/telegram/bot/types/bot_command_scope.rb create mode 100644 lib/telegram/bot/types/business_connection.rb create mode 100644 lib/telegram/bot/types/business_intro.rb create mode 100644 lib/telegram/bot/types/business_location.rb create mode 100644 lib/telegram/bot/types/business_messages_deleted.rb create mode 100644 lib/telegram/bot/types/business_opening_hours.rb create mode 100644 lib/telegram/bot/types/business_opening_hours_interval.rb create mode 100644 lib/telegram/bot/types/chat_background.rb create mode 100644 lib/telegram/bot/types/chat_boost_added.rb create mode 100644 lib/telegram/bot/types/chat_full_info.rb create mode 100644 lib/telegram/bot/types/copy_text_button.rb create mode 100644 lib/telegram/bot/types/error.rb create mode 100644 lib/telegram/bot/types/gift.rb create mode 100644 lib/telegram/bot/types/gifts.rb create mode 100644 lib/telegram/bot/types/inline_query_result.rb create mode 100644 lib/telegram/bot/types/inline_query_results_button.rb create mode 100644 lib/telegram/bot/types/input_media.rb create mode 100644 lib/telegram/bot/types/input_paid_media.rb create mode 100644 lib/telegram/bot/types/input_paid_media_photo.rb create mode 100644 lib/telegram/bot/types/input_paid_media_video.rb create mode 100644 lib/telegram/bot/types/input_poll_option.rb create mode 100644 lib/telegram/bot/types/input_sticker.rb create mode 100644 lib/telegram/bot/types/menu_button.rb create mode 100644 lib/telegram/bot/types/paid_media.rb create mode 100644 lib/telegram/bot/types/paid_media_info.rb create mode 100644 lib/telegram/bot/types/paid_media_photo.rb create mode 100644 lib/telegram/bot/types/paid_media_preview.rb create mode 100644 lib/telegram/bot/types/paid_media_purchased.rb create mode 100644 lib/telegram/bot/types/paid_media_video.rb create mode 100644 lib/telegram/bot/types/passport_element_error.rb create mode 100644 lib/telegram/bot/types/prepared_inline_message.rb create mode 100644 lib/telegram/bot/types/reaction_type_paid.rb create mode 100644 lib/telegram/bot/types/refunded_payment.rb create mode 100644 lib/telegram/bot/types/response_parameters.rb create mode 100644 lib/telegram/bot/types/revenue_withdrawal_state.rb create mode 100644 lib/telegram/bot/types/revenue_withdrawal_state_failed.rb create mode 100644 lib/telegram/bot/types/revenue_withdrawal_state_pending.rb create mode 100644 lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb create mode 100644 lib/telegram/bot/types/shared_user.rb create mode 100644 lib/telegram/bot/types/star_transaction.rb create mode 100644 lib/telegram/bot/types/star_transactions.rb create mode 100644 lib/telegram/bot/types/transaction_partner.rb create mode 100644 lib/telegram/bot/types/transaction_partner_fragment.rb create mode 100644 lib/telegram/bot/types/transaction_partner_other.rb create mode 100644 lib/telegram/bot/types/transaction_partner_telegram_ads.rb create mode 100644 lib/telegram/bot/types/transaction_partner_telegram_api.rb create mode 100644 lib/telegram/bot/types/transaction_partner_user.rb create mode 100644 rakelib/parse_schema.rake create mode 100644 rakelib/rebuild_types.rake delete mode 100644 spec/support/type_attributes.yml create mode 100644 utility/empty_type.erb create mode 100644 utility/type.erb create mode 100644 utility/type_attributes.json diff --git a/CHANGELOG.md b/CHANGELOG.md index faf4fee7..2f3376ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.1.0 + +### Added + +- [Bot API 8.0](https://core.telegram.org/bots/api#november-17-2024) + ## 2.0.0 ### Added diff --git a/Gemfile b/Gemfile index 7babb390..fb923f7d 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,11 @@ gem 'rake', '~> 13.0' gem 'rspec', '~> 3.4' gem 'vcr', '~> 6.0' -gem 'rubocop', '~> 1.54.1' +gem 'rubocop', '~> 1.66.1' gem 'rubocop-performance', '~> 1.18' gem 'rubocop-rake', '~> 0.6.0' -gem 'rubocop-rspec', '~> 2.22.0' +gem 'rubocop-rspec', '~> 3.1.0' + +group :development do + gem 'openapi3_parser', '~> 0.9.2' +end diff --git a/Rakefile b/Rakefile index efe63ec6..e56f4750 100644 --- a/Rakefile +++ b/Rakefile @@ -15,48 +15,3 @@ end RSpec::Core::RakeTask.new(:spec) task default: :spec - -desc 'Dump type definitions from docs to YAML' -task :dump_type_attributes do - require_relative 'lib/telegram/bot' - require 'nokogiri' - require 'open-uri' - require 'yaml' - - # Preload every type we have - Zeitwerk::Loader.eager_load_all - types = Telegram::Bot::Types::Base.descendants.map { |c| c.name.split('::').last } - - # Fetch and parse docs - doc = Nokogiri::HTML(URI.open('https://core.telegram.org/bots/api').read) - - next_type_element_names = %w[table h4] - - result = types.to_h do |type| - # This is very hacky but working way to find table containing attributes for - # given type. Basic idea is to find heading with type and then iterate until - # we find table with attributes or next heading (because sometimes type - # doesn't have any attributes). - element = doc.at_xpath(%{//h4[text() = "#{type}"]}) - loop do - element = element.next_element - break if next_type_element_names.include?(element.name) - end - - attributes = element.xpath('.//tbody//tr').map do |el| - cells = el.children.select { |c| c.name == 'td' } - { - 'name' => cells[0].text, - 'type' => cells[1].text, - 'required' => !cells[2].text.start_with?('Optional.'), - 'required_value' => - cells[2].text.match(/^.+, (?:must be (?\w+)|always “(?\w+)”)$/)&.[](:found_type) - }.compact - end - - [type, attributes] - end - - # Write everything to fixture file - File.write "#{__dir__}/spec/support/type_attributes.yml", result.to_yaml -end diff --git a/lib/telegram/bot/api/endpoints.rb b/lib/telegram/bot/api/endpoints.rb index 212677da..31cc24c2 100644 --- a/lib/telegram/bot/api/endpoints.rb +++ b/lib/telegram/bot/api/endpoints.rb @@ -33,7 +33,7 @@ class Api 'restrictChatMember' => Types::Bool, 'promoteChatMember' => Types::Bool, 'leaveChat' => Types::Bool, - 'getChat' => Types::Chat, + 'getChat' => Types::ChatFullInfo, 'getChatAdministrators' => Types::Array.of(Types::ChatMember), 'exportChatInviteLink' => Types::String, 'setChatPhoto' => Types::Bool, @@ -107,7 +107,17 @@ class Api 'setMyDescription' => Types::Bool, 'getMyDescription' => Types::BotDescription, 'setMyShortDescription' => Types::Bool, - 'getMyShortDescription' => Types::BotShortDescription + 'getMyShortDescription' => Types::BotShortDescription, + 'refundStarPayment' => Types::Bool, + 'getStarTransactions' => Types::StarTransactions, + 'sendPaidMedia' => Types::Message, + 'createChatSubscriptionInviteLink' => Types::ChatInviteLink, + 'editChatSubscriptionInviteLink' => Types::ChatInviteLink, + 'getAvailableGifts' => Types::Gifts, + 'sendGift' => Types::Bool, + 'savePreparedInlineMessage' => Types::PreparedInlineMessage, + 'editUserStarSubscription' => Types::Bool, + 'setUserEmojiStatus' => Types::Bool }.freeze end end diff --git a/lib/telegram/bot/exceptions/response_error.rb b/lib/telegram/bot/exceptions/response_error.rb index 446a8078..ac5df7e4 100644 --- a/lib/telegram/bot/exceptions/response_error.rb +++ b/lib/telegram/bot/exceptions/response_error.rb @@ -9,7 +9,7 @@ class ResponseError < Base def initialize(response:) @response = response - super "Telegram API has returned the error. (#{data.map { |k, v| %(#{k}: #{v.inspect}) }.join(', ')})" + super("Telegram API has returned the error. (#{data.map { |k, v| %(#{k}: #{v.inspect}) }.join(', ')})") end def error_code diff --git a/lib/telegram/bot/types/background_fill.rb b/lib/telegram/bot/types/background_fill.rb new file mode 100644 index 00000000..bb4927b4 --- /dev/null +++ b/lib/telegram/bot/types/background_fill.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + BackgroundFill = ( + BackgroundFillSolid | + BackgroundFillGradient | + BackgroundFillFreeformGradient + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/background_fill_freeform_gradient.rb b/lib/telegram/bot/types/background_fill_freeform_gradient.rb new file mode 100644 index 00000000..de2919ff --- /dev/null +++ b/lib/telegram/bot/types/background_fill_freeform_gradient.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundFillFreeformGradient < Base + attribute :type, Types::String.constrained(eql: 'freeform_gradient').default('freeform_gradient') + attribute :colors, Types::Array.of(Types::Integer) + end + end + end +end diff --git a/lib/telegram/bot/types/background_fill_gradient.rb b/lib/telegram/bot/types/background_fill_gradient.rb new file mode 100644 index 00000000..01ab0fe2 --- /dev/null +++ b/lib/telegram/bot/types/background_fill_gradient.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundFillGradient < Base + attribute :type, Types::String.constrained(eql: 'gradient').default('gradient') + attribute :top_color, Types::Integer + attribute :bottom_color, Types::Integer + attribute :rotation_angle, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/background_fill_solid.rb b/lib/telegram/bot/types/background_fill_solid.rb new file mode 100644 index 00000000..5a146312 --- /dev/null +++ b/lib/telegram/bot/types/background_fill_solid.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundFillSolid < Base + attribute :type, Types::String.constrained(eql: 'solid').default('solid') + attribute :color, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/background_type.rb b/lib/telegram/bot/types/background_type.rb new file mode 100644 index 00000000..7e2951e3 --- /dev/null +++ b/lib/telegram/bot/types/background_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + BackgroundType = ( + BackgroundTypeFill | + BackgroundTypeWallpaper | + BackgroundTypePattern | + BackgroundTypeChatTheme + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/background_type_chat_theme.rb b/lib/telegram/bot/types/background_type_chat_theme.rb new file mode 100644 index 00000000..ca2051ab --- /dev/null +++ b/lib/telegram/bot/types/background_type_chat_theme.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundTypeChatTheme < Base + attribute :type, Types::String.constrained(eql: 'chat_theme').default('chat_theme') + attribute :theme_name, Types::String + end + end + end +end diff --git a/lib/telegram/bot/types/background_type_fill.rb b/lib/telegram/bot/types/background_type_fill.rb new file mode 100644 index 00000000..8c9e3591 --- /dev/null +++ b/lib/telegram/bot/types/background_type_fill.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundTypeFill < Base + attribute :type, Types::String.constrained(eql: 'fill').default('fill') + attribute :fill, BackgroundFill + attribute :dark_theme_dimming, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/background_type_pattern.rb b/lib/telegram/bot/types/background_type_pattern.rb new file mode 100644 index 00000000..b1801a77 --- /dev/null +++ b/lib/telegram/bot/types/background_type_pattern.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundTypePattern < Base + attribute :type, Types::String.constrained(eql: 'pattern').default('pattern') + attribute :document, Document + attribute :fill, BackgroundFill + attribute :intensity, Types::Integer + attribute? :is_inverted, Types::True + attribute? :is_moving, Types::True + end + end + end +end diff --git a/lib/telegram/bot/types/background_type_wallpaper.rb b/lib/telegram/bot/types/background_type_wallpaper.rb new file mode 100644 index 00000000..28272174 --- /dev/null +++ b/lib/telegram/bot/types/background_type_wallpaper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BackgroundTypeWallpaper < Base + attribute :type, Types::String.constrained(eql: 'wallpaper').default('wallpaper') + attribute :document, Document + attribute :dark_theme_dimming, Types::Integer + attribute? :is_blurred, Types::True + attribute? :is_moving, Types::True + end + end + end +end diff --git a/lib/telegram/bot/types/birthdate.rb b/lib/telegram/bot/types/birthdate.rb new file mode 100644 index 00000000..e5bc6de8 --- /dev/null +++ b/lib/telegram/bot/types/birthdate.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class Birthdate < Base + attribute :day, Types::Integer + attribute :month, Types::Integer + attribute? :year, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/bot_command.rb b/lib/telegram/bot/types/bot_command.rb index c1c44a70..b44a8bc3 100644 --- a/lib/telegram/bot/types/bot_command.rb +++ b/lib/telegram/bot/types/bot_command.rb @@ -4,8 +4,8 @@ module Telegram module Bot module Types class BotCommand < Base - attribute :command, Types::String - attribute :description, Types::String + attribute :command, Types::String.constrained(min_size: 1, max_size: 32) + attribute :description, Types::String.constrained(min_size: 1, max_size: 256) end end end diff --git a/lib/telegram/bot/types/bot_command_scope.rb b/lib/telegram/bot/types/bot_command_scope.rb new file mode 100644 index 00000000..7de6a29c --- /dev/null +++ b/lib/telegram/bot/types/bot_command_scope.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + BotCommandScope = ( + BotCommandScopeDefault | + BotCommandScopeAllPrivateChats | + BotCommandScopeAllGroupChats | + BotCommandScopeAllChatAdministrators | + BotCommandScopeChat | + BotCommandScopeChatAdministrators | + BotCommandScopeChatMember + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/business_connection.rb b/lib/telegram/bot/types/business_connection.rb new file mode 100644 index 00000000..c63c6d5f --- /dev/null +++ b/lib/telegram/bot/types/business_connection.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BusinessConnection < Base + attribute :id, Types::String + attribute :user, User + attribute :user_chat_id, Types::Integer + attribute :date, Types::Integer + attribute :can_reply, Types::Bool + attribute :is_enabled, Types::Bool + end + end + end +end diff --git a/lib/telegram/bot/types/business_intro.rb b/lib/telegram/bot/types/business_intro.rb new file mode 100644 index 00000000..5ef4d22b --- /dev/null +++ b/lib/telegram/bot/types/business_intro.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BusinessIntro < Base + attribute? :title, Types::String + attribute? :message, Types::String + attribute? :sticker, Sticker + end + end + end +end diff --git a/lib/telegram/bot/types/business_location.rb b/lib/telegram/bot/types/business_location.rb new file mode 100644 index 00000000..ec4e77a0 --- /dev/null +++ b/lib/telegram/bot/types/business_location.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BusinessLocation < Base + attribute :address, Types::String + attribute? :location, Location + end + end + end +end diff --git a/lib/telegram/bot/types/business_messages_deleted.rb b/lib/telegram/bot/types/business_messages_deleted.rb new file mode 100644 index 00000000..25f85cb0 --- /dev/null +++ b/lib/telegram/bot/types/business_messages_deleted.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BusinessMessagesDeleted < Base + attribute :business_connection_id, Types::String + attribute :chat, Chat + attribute :message_ids, Types::Array.of(Types::Integer) + end + end + end +end diff --git a/lib/telegram/bot/types/business_opening_hours.rb b/lib/telegram/bot/types/business_opening_hours.rb new file mode 100644 index 00000000..79950bc8 --- /dev/null +++ b/lib/telegram/bot/types/business_opening_hours.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BusinessOpeningHours < Base + attribute :time_zone_name, Types::String + attribute :opening_hours, Types::Array.of(BusinessOpeningHoursInterval) + end + end + end +end diff --git a/lib/telegram/bot/types/business_opening_hours_interval.rb b/lib/telegram/bot/types/business_opening_hours_interval.rb new file mode 100644 index 00000000..dbed133f --- /dev/null +++ b/lib/telegram/bot/types/business_opening_hours_interval.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class BusinessOpeningHoursInterval < Base + attribute :opening_minute, Types::Integer + attribute :closing_minute, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/chat.rb b/lib/telegram/bot/types/chat.rb index f5db6a61..1f8085d8 100644 --- a/lib/telegram/bot/types/chat.rb +++ b/lib/telegram/bot/types/chat.rb @@ -11,34 +11,6 @@ class Chat < Base attribute? :first_name, Types::String attribute? :last_name, Types::String attribute? :is_forum, Types::True - attribute? :photo, ChatPhoto - attribute? :active_usernames, Types::Array.of(Types::String) - attribute? :available_reactions, Types::Array.of(ReactionType) - attribute? :accent_color_id, Types::Integer - attribute? :background_custom_emoji_id, Types::String - attribute? :profile_accent_color_id, Types::Integer - attribute? :profile_background_custom_emoji_id, Types::String - attribute? :emoji_status_custom_emoji_id, Types::String - attribute? :emoji_status_expiration_date, Types::Integer - attribute? :bio, Types::String - attribute? :has_private_forwards, Types::True - attribute? :has_restricted_voice_and_video_messages, Types::True - attribute? :join_to_send_messages, Types::True - attribute? :join_by_request, Types::True - attribute? :description, Types::String - attribute? :invite_link, Types::String - attribute? :pinned_message, Message - attribute? :permissions, ChatPermissions - attribute? :slow_mode_delay, Types::Integer - attribute? :message_auto_delete_time, Types::Integer - attribute? :has_aggressive_anti_spam_enabled, Types::True - attribute? :has_hidden_members, Types::True - attribute? :has_protected_content, Types::True - attribute? :has_visible_history, Types::True - attribute? :sticker_set_name, Types::String - attribute? :can_set_sticker_set, Types::True - attribute? :linked_chat_id, Types::Integer - attribute? :location, ChatLocation end end end diff --git a/lib/telegram/bot/types/chat_administrator_rights.rb b/lib/telegram/bot/types/chat_administrator_rights.rb index 691f180b..f20b164e 100644 --- a/lib/telegram/bot/types/chat_administrator_rights.rb +++ b/lib/telegram/bot/types/chat_administrator_rights.rb @@ -12,12 +12,12 @@ class ChatAdministratorRights < Base attribute :can_promote_members, Types::Bool attribute :can_change_info, Types::Bool attribute :can_invite_users, Types::Bool + attribute :can_post_stories, Types::Bool + attribute :can_edit_stories, Types::Bool + attribute :can_delete_stories, Types::Bool attribute? :can_post_messages, Types::Bool attribute? :can_edit_messages, Types::Bool attribute? :can_pin_messages, Types::Bool - attribute? :can_post_stories, Types::Bool - attribute? :can_edit_stories, Types::Bool - attribute? :can_delete_stories, Types::Bool attribute? :can_manage_topics, Types::Bool end end diff --git a/lib/telegram/bot/types/chat_background.rb b/lib/telegram/bot/types/chat_background.rb new file mode 100644 index 00000000..9b5f120e --- /dev/null +++ b/lib/telegram/bot/types/chat_background.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class ChatBackground < Base + attribute :type, BackgroundType + end + end + end +end diff --git a/lib/telegram/bot/types/chat_boost_added.rb b/lib/telegram/bot/types/chat_boost_added.rb new file mode 100644 index 00000000..75feb667 --- /dev/null +++ b/lib/telegram/bot/types/chat_boost_added.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class ChatBoostAdded < Base + attribute :boost_count, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/chat_boost_source.rb b/lib/telegram/bot/types/chat_boost_source.rb index 097509db..defb41ee 100644 --- a/lib/telegram/bot/types/chat_boost_source.rb +++ b/lib/telegram/bot/types/chat_boost_source.rb @@ -3,11 +3,14 @@ module Telegram module Bot module Types - ChatBoostSource = ( # rubocop:disable Naming/ConstantName + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + ChatBoostSource = ( ChatBoostSourcePremium | ChatBoostSourceGiftCode | ChatBoostSourceGiveaway ) + # rubocop:enable Naming/ConstantName end end end diff --git a/lib/telegram/bot/types/chat_boost_source_giveaway.rb b/lib/telegram/bot/types/chat_boost_source_giveaway.rb index bdfbfe45..78e20af0 100644 --- a/lib/telegram/bot/types/chat_boost_source_giveaway.rb +++ b/lib/telegram/bot/types/chat_boost_source_giveaway.rb @@ -7,6 +7,7 @@ class ChatBoostSourceGiveaway < Base attribute :source, Types::String.constrained(eql: 'giveaway').default('giveaway') attribute :giveaway_message_id, Types::Integer attribute? :user, User + attribute? :prize_star_count, Types::Integer attribute? :is_unclaimed, Types::True end end diff --git a/lib/telegram/bot/types/chat_full_info.rb b/lib/telegram/bot/types/chat_full_info.rb new file mode 100644 index 00000000..07d54b21 --- /dev/null +++ b/lib/telegram/bot/types/chat_full_info.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class ChatFullInfo < Base + attribute :id, Types::Integer + attribute :type, Types::String + attribute? :title, Types::String + attribute? :username, Types::String + attribute? :first_name, Types::String + attribute? :last_name, Types::String + attribute? :is_forum, Types::True + attribute :accent_color_id, Types::Integer + attribute :max_reaction_count, Types::Integer + attribute? :photo, ChatPhoto + attribute? :active_usernames, Types::Array.of(Types::String) + attribute? :birthdate, Birthdate + attribute? :business_intro, BusinessIntro + attribute? :business_location, BusinessLocation + attribute? :business_opening_hours, BusinessOpeningHours + attribute? :personal_chat, Chat + attribute? :available_reactions, Types::Array.of(ReactionType) + attribute? :background_custom_emoji_id, Types::String + attribute? :profile_accent_color_id, Types::Integer + attribute? :profile_background_custom_emoji_id, Types::String + attribute? :emoji_status_custom_emoji_id, Types::String + attribute? :emoji_status_expiration_date, Types::Integer + attribute? :bio, Types::String + attribute? :has_private_forwards, Types::True + attribute? :has_restricted_voice_and_video_messages, Types::True + attribute? :join_to_send_messages, Types::True + attribute? :join_by_request, Types::True + attribute? :description, Types::String + attribute? :invite_link, Types::String + attribute? :pinned_message, Message + attribute? :permissions, ChatPermissions + attribute? :can_send_paid_media, Types::True + attribute? :slow_mode_delay, Types::Integer + attribute? :unrestrict_boost_count, Types::Integer + attribute? :message_auto_delete_time, Types::Integer + attribute? :has_aggressive_anti_spam_enabled, Types::True + attribute? :has_hidden_members, Types::True + attribute? :has_protected_content, Types::True + attribute? :has_visible_history, Types::True + attribute? :sticker_set_name, Types::String + attribute? :can_set_sticker_set, Types::True + attribute? :custom_emoji_sticker_set_name, Types::String + attribute? :linked_chat_id, Types::Integer + attribute? :location, ChatLocation + end + end + end +end diff --git a/lib/telegram/bot/types/chat_invite_link.rb b/lib/telegram/bot/types/chat_invite_link.rb index 28d8349e..b22a7c36 100644 --- a/lib/telegram/bot/types/chat_invite_link.rb +++ b/lib/telegram/bot/types/chat_invite_link.rb @@ -13,6 +13,8 @@ class ChatInviteLink < Base attribute? :expire_date, Types::Integer attribute? :member_limit, Types::Integer attribute? :pending_join_request_count, Types::Integer + attribute? :subscription_period, Types::Integer + attribute? :subscription_price, Types::Integer end end end diff --git a/lib/telegram/bot/types/chat_location.rb b/lib/telegram/bot/types/chat_location.rb index bf9d14d6..6e0fd505 100644 --- a/lib/telegram/bot/types/chat_location.rb +++ b/lib/telegram/bot/types/chat_location.rb @@ -5,7 +5,7 @@ module Bot module Types class ChatLocation < Base attribute :location, Location - attribute :address, Types::String + attribute :address, Types::String.constrained(min_size: 1, max_size: 64) end end end diff --git a/lib/telegram/bot/types/chat_member.rb b/lib/telegram/bot/types/chat_member.rb index 8e2344cf..031241ef 100644 --- a/lib/telegram/bot/types/chat_member.rb +++ b/lib/telegram/bot/types/chat_member.rb @@ -6,12 +6,12 @@ module Types ## Just for classes consistency # rubocop:disable Naming/ConstantName ChatMember = ( + ChatMemberOwner | ChatMemberAdministrator | - ChatMemberBanned | - ChatMemberLeft | ChatMemberMember | - ChatMemberOwner | - ChatMemberRestricted + ChatMemberRestricted | + ChatMemberLeft | + ChatMemberBanned ) # rubocop:enable Naming/ConstantName end diff --git a/lib/telegram/bot/types/chat_member_administrator.rb b/lib/telegram/bot/types/chat_member_administrator.rb index ab9c4ae2..4a80ece2 100644 --- a/lib/telegram/bot/types/chat_member_administrator.rb +++ b/lib/telegram/bot/types/chat_member_administrator.rb @@ -15,12 +15,12 @@ class ChatMemberAdministrator < Base attribute :can_promote_members, Types::Bool attribute :can_change_info, Types::Bool attribute :can_invite_users, Types::Bool + attribute :can_post_stories, Types::Bool + attribute :can_edit_stories, Types::Bool + attribute :can_delete_stories, Types::Bool attribute? :can_post_messages, Types::Bool attribute? :can_edit_messages, Types::Bool attribute? :can_pin_messages, Types::Bool - attribute? :can_post_stories, Types::Bool - attribute? :can_edit_stories, Types::Bool - attribute? :can_delete_stories, Types::Bool attribute? :can_manage_topics, Types::Bool attribute? :custom_title, Types::String end diff --git a/lib/telegram/bot/types/chat_member_member.rb b/lib/telegram/bot/types/chat_member_member.rb index 501dc5d2..75c7dea3 100644 --- a/lib/telegram/bot/types/chat_member_member.rb +++ b/lib/telegram/bot/types/chat_member_member.rb @@ -6,6 +6,7 @@ module Types class ChatMemberMember < Base attribute :status, Types::String.constrained(eql: 'member').default('member') attribute :user, User + attribute? :until_date, Types::Integer end end end diff --git a/lib/telegram/bot/types/chat_member_updated.rb b/lib/telegram/bot/types/chat_member_updated.rb index 45f4fb52..cc961a22 100644 --- a/lib/telegram/bot/types/chat_member_updated.rb +++ b/lib/telegram/bot/types/chat_member_updated.rb @@ -10,6 +10,7 @@ class ChatMemberUpdated < Base attribute :old_chat_member, ChatMember attribute :new_chat_member, ChatMember attribute? :invite_link, ChatInviteLink + attribute? :via_join_request, Types::Bool attribute? :via_chat_folder_invite_link, Types::Bool end end diff --git a/lib/telegram/bot/types/chat_shared.rb b/lib/telegram/bot/types/chat_shared.rb index 97e1a3ae..3af820d8 100644 --- a/lib/telegram/bot/types/chat_shared.rb +++ b/lib/telegram/bot/types/chat_shared.rb @@ -6,6 +6,9 @@ module Types class ChatShared < Base attribute :request_id, Types::Integer attribute :chat_id, Types::Integer + attribute? :title, Types::String + attribute? :username, Types::String + attribute? :photo, Types::Array.of(PhotoSize) end end end diff --git a/lib/telegram/bot/types/copy_text_button.rb b/lib/telegram/bot/types/copy_text_button.rb new file mode 100644 index 00000000..39c2ac70 --- /dev/null +++ b/lib/telegram/bot/types/copy_text_button.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class CopyTextButton < Base + attribute :text, Types::String.constrained(min_size: 1, max_size: 256) + end + end + end +end diff --git a/lib/telegram/bot/types/error.rb b/lib/telegram/bot/types/error.rb new file mode 100644 index 00000000..beb8ded4 --- /dev/null +++ b/lib/telegram/bot/types/error.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class Error < Base + attribute :ok, Types::Bool + attribute :error_code, Types::Integer + attribute :description, Types::String + attribute? :parameters, ResponseParameters + end + end + end +end diff --git a/lib/telegram/bot/types/external_reply_info.rb b/lib/telegram/bot/types/external_reply_info.rb index 1f17b5b6..4e93cd96 100644 --- a/lib/telegram/bot/types/external_reply_info.rb +++ b/lib/telegram/bot/types/external_reply_info.rb @@ -11,6 +11,7 @@ class ExternalReplyInfo < Base attribute? :animation, Animation attribute? :audio, Audio attribute? :document, Document + attribute? :paid_media, PaidMediaInfo attribute? :photo, Types::Array.of(PhotoSize) attribute? :sticker, Sticker attribute? :story, Story diff --git a/lib/telegram/bot/types/force_reply.rb b/lib/telegram/bot/types/force_reply.rb index 9af4e3fb..03fd7581 100644 --- a/lib/telegram/bot/types/force_reply.rb +++ b/lib/telegram/bot/types/force_reply.rb @@ -5,8 +5,8 @@ module Bot module Types class ForceReply < Base attribute :force_reply, Types::True - attribute? :input_field_placeholder, Types::String - attribute? :selective, Types::Bool.default(false) + attribute? :input_field_placeholder, Types::String.constrained(min_size: 1, max_size: 64) + attribute? :selective, Types::Bool end end end diff --git a/lib/telegram/bot/types/gift.rb b/lib/telegram/bot/types/gift.rb new file mode 100644 index 00000000..da07c944 --- /dev/null +++ b/lib/telegram/bot/types/gift.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class Gift < Base + attribute :id, Types::String + attribute :sticker, Sticker + attribute :star_count, Types::Integer + attribute? :total_count, Types::Integer + attribute? :remaining_count, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/gifts.rb b/lib/telegram/bot/types/gifts.rb new file mode 100644 index 00000000..be0a745a --- /dev/null +++ b/lib/telegram/bot/types/gifts.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class Gifts < Base + attribute :gifts, Types::Array.of(Gift) + end + end + end +end diff --git a/lib/telegram/bot/types/giveaway.rb b/lib/telegram/bot/types/giveaway.rb index 2d14c4a8..cb555356 100644 --- a/lib/telegram/bot/types/giveaway.rb +++ b/lib/telegram/bot/types/giveaway.rb @@ -11,6 +11,7 @@ class Giveaway < Base attribute? :has_public_winners, Types::True attribute? :prize_description, Types::String attribute? :country_codes, Types::Array.of(Types::String) + attribute? :prize_star_count, Types::Integer attribute? :premium_subscription_month_count, Types::Integer end end diff --git a/lib/telegram/bot/types/giveaway_completed.rb b/lib/telegram/bot/types/giveaway_completed.rb index a953d1e0..06a4efeb 100644 --- a/lib/telegram/bot/types/giveaway_completed.rb +++ b/lib/telegram/bot/types/giveaway_completed.rb @@ -7,6 +7,7 @@ class GiveawayCompleted < Base attribute :winner_count, Types::Integer attribute? :unclaimed_prize_count, Types::Integer attribute? :giveaway_message, Message + attribute? :is_star_giveaway, Types::True end end end diff --git a/lib/telegram/bot/types/giveaway_created.rb b/lib/telegram/bot/types/giveaway_created.rb index 8843504e..c2f6ed2e 100644 --- a/lib/telegram/bot/types/giveaway_created.rb +++ b/lib/telegram/bot/types/giveaway_created.rb @@ -4,6 +4,7 @@ module Telegram module Bot module Types class GiveawayCreated < Base + attribute? :prize_star_count, Types::Integer end end end diff --git a/lib/telegram/bot/types/giveaway_winners.rb b/lib/telegram/bot/types/giveaway_winners.rb index 93351960..44231dbf 100644 --- a/lib/telegram/bot/types/giveaway_winners.rb +++ b/lib/telegram/bot/types/giveaway_winners.rb @@ -10,6 +10,7 @@ class GiveawayWinners < Base attribute :winner_count, Types::Integer attribute :winners, Types::Array.of(User) attribute? :additional_chat_count, Types::Integer + attribute? :prize_star_count, Types::Integer attribute? :premium_subscription_month_count, Types::Integer attribute? :unclaimed_prize_count, Types::Integer attribute? :only_new_members, Types::True diff --git a/lib/telegram/bot/types/inline_keyboard_button.rb b/lib/telegram/bot/types/inline_keyboard_button.rb index fb753e89..f9e0d08e 100644 --- a/lib/telegram/bot/types/inline_keyboard_button.rb +++ b/lib/telegram/bot/types/inline_keyboard_button.rb @@ -11,7 +11,8 @@ class InlineKeyboardButton < Base attribute? :login_url, LoginUrl attribute? :switch_inline_query, Types::String attribute? :switch_inline_query_current_chat, Types::String - attribute? :switch_inline_query_chosen_chat, Types::SwitchInlineQueryChosenChat + attribute? :switch_inline_query_chosen_chat, SwitchInlineQueryChosenChat + attribute? :copy_text, CopyTextButton attribute? :callback_game, CallbackGame attribute? :pay, Types::Bool end diff --git a/lib/telegram/bot/types/inline_query_result.rb b/lib/telegram/bot/types/inline_query_result.rb new file mode 100644 index 00000000..57bf369f --- /dev/null +++ b/lib/telegram/bot/types/inline_query_result.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + InlineQueryResult = ( + InlineQueryResultCachedAudio | + InlineQueryResultCachedDocument | + InlineQueryResultCachedGif | + InlineQueryResultCachedMpeg4Gif | + InlineQueryResultCachedPhoto | + InlineQueryResultCachedSticker | + InlineQueryResultCachedVideo | + InlineQueryResultCachedVoice | + InlineQueryResultArticle | + InlineQueryResultAudio | + InlineQueryResultContact | + InlineQueryResultGame | + InlineQueryResultDocument | + InlineQueryResultGif | + InlineQueryResultLocation | + InlineQueryResultMpeg4Gif | + InlineQueryResultPhoto | + InlineQueryResultVenue | + InlineQueryResultVideo | + InlineQueryResultVoice + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/inline_query_result_cached_gif.rb b/lib/telegram/bot/types/inline_query_result_cached_gif.rb index dd707e49..ce729d21 100644 --- a/lib/telegram/bot/types/inline_query_result_cached_gif.rb +++ b/lib/telegram/bot/types/inline_query_result_cached_gif.rb @@ -11,6 +11,7 @@ class InlineQueryResultCachedGif < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb b/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb index e9f0dc89..4b9cd3c6 100644 --- a/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +++ b/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb @@ -11,6 +11,7 @@ class InlineQueryResultCachedMpeg4Gif < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_cached_photo.rb b/lib/telegram/bot/types/inline_query_result_cached_photo.rb index eeb2ff5c..38517231 100644 --- a/lib/telegram/bot/types/inline_query_result_cached_photo.rb +++ b/lib/telegram/bot/types/inline_query_result_cached_photo.rb @@ -12,6 +12,7 @@ class InlineQueryResultCachedPhoto < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_cached_video.rb b/lib/telegram/bot/types/inline_query_result_cached_video.rb index 40768760..1f802f4e 100644 --- a/lib/telegram/bot/types/inline_query_result_cached_video.rb +++ b/lib/telegram/bot/types/inline_query_result_cached_video.rb @@ -12,6 +12,7 @@ class InlineQueryResultCachedVideo < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_gif.rb b/lib/telegram/bot/types/inline_query_result_gif.rb index 183c12a3..cb733e9e 100644 --- a/lib/telegram/bot/types/inline_query_result_gif.rb +++ b/lib/telegram/bot/types/inline_query_result_gif.rb @@ -11,11 +11,12 @@ class InlineQueryResultGif < Base attribute? :gif_height, Types::Integer attribute? :gif_duration, Types::Integer attribute :thumbnail_url, Types::String - attribute? :thumbnail_mime_type, Types::String + attribute? :thumbnail_mime_type, Types::String.default('image/jpeg') attribute? :title, Types::String attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb b/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb index 03a1b089..8f13dc1a 100644 --- a/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +++ b/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb @@ -11,11 +11,12 @@ class InlineQueryResultMpeg4Gif < Base attribute? :mpeg4_height, Types::Integer attribute? :mpeg4_duration, Types::Integer attribute :thumbnail_url, Types::String - attribute? :thumbnail_mime_type, Types::String + attribute? :thumbnail_mime_type, Types::String.default('image/jpeg') attribute? :title, Types::String attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_photo.rb b/lib/telegram/bot/types/inline_query_result_photo.rb index bc9f5e81..378a323f 100644 --- a/lib/telegram/bot/types/inline_query_result_photo.rb +++ b/lib/telegram/bot/types/inline_query_result_photo.rb @@ -15,6 +15,7 @@ class InlineQueryResultPhoto < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :reply_markup, InlineKeyboardMarkup attribute? :input_message_content, InputMessageContent end diff --git a/lib/telegram/bot/types/inline_query_result_video.rb b/lib/telegram/bot/types/inline_query_result_video.rb index 5bd8a5c6..8343a64f 100644 --- a/lib/telegram/bot/types/inline_query_result_video.rb +++ b/lib/telegram/bot/types/inline_query_result_video.rb @@ -13,6 +13,7 @@ class InlineQueryResultVideo < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :video_width, Types::Integer attribute? :video_height, Types::Integer attribute? :video_duration, Types::Integer diff --git a/lib/telegram/bot/types/inline_query_results_button.rb b/lib/telegram/bot/types/inline_query_results_button.rb new file mode 100644 index 00000000..b27d47a2 --- /dev/null +++ b/lib/telegram/bot/types/inline_query_results_button.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class InlineQueryResultsButton < Base + attribute :text, Types::String + attribute? :web_app, WebAppInfo + attribute? :start_parameter, Types::String.constrained(min_size: 1, max_size: 64) + end + end + end +end diff --git a/lib/telegram/bot/types/input_contact_message_content.rb b/lib/telegram/bot/types/input_contact_message_content.rb index 7e4a6478..44fe0382 100644 --- a/lib/telegram/bot/types/input_contact_message_content.rb +++ b/lib/telegram/bot/types/input_contact_message_content.rb @@ -3,7 +3,7 @@ module Telegram module Bot module Types - class InputContactMessageContent < InputMessageContent + class InputContactMessageContent < Base attribute :phone_number, Types::String attribute :first_name, Types::String attribute? :last_name, Types::String diff --git a/lib/telegram/bot/types/input_invoice_message_content.rb b/lib/telegram/bot/types/input_invoice_message_content.rb index 42fef0e9..35ccddcd 100644 --- a/lib/telegram/bot/types/input_invoice_message_content.rb +++ b/lib/telegram/bot/types/input_invoice_message_content.rb @@ -3,14 +3,14 @@ module Telegram module Bot module Types - class InputInvoiceMessageContent < InputMessageContent - attribute :title, Types::String - attribute :description, Types::String + class InputInvoiceMessageContent < Base + attribute :title, Types::String.constrained(min_size: 1, max_size: 32) + attribute :description, Types::String.constrained(min_size: 1, max_size: 255) attribute :payload, Types::String - attribute :provider_token, Types::String + attribute? :provider_token, Types::String attribute :currency, Types::String attribute :prices, Types::Array.of(LabeledPrice) - attribute? :max_tip_amount, Types::Integer + attribute? :max_tip_amount, Types::Integer.default(0) attribute? :suggested_tip_amounts, Types::Array.of(Types::Integer) attribute? :provider_data, Types::String attribute? :photo_url, Types::String diff --git a/lib/telegram/bot/types/input_location_message_content.rb b/lib/telegram/bot/types/input_location_message_content.rb index 97da31a9..653be3e1 100644 --- a/lib/telegram/bot/types/input_location_message_content.rb +++ b/lib/telegram/bot/types/input_location_message_content.rb @@ -3,7 +3,7 @@ module Telegram module Bot module Types - class InputLocationMessageContent < InputMessageContent + class InputLocationMessageContent < Base attribute :latitude, Types::Float attribute :longitude, Types::Float attribute? :horizontal_accuracy, Types::Float diff --git a/lib/telegram/bot/types/input_media.rb b/lib/telegram/bot/types/input_media.rb new file mode 100644 index 00000000..a654d906 --- /dev/null +++ b/lib/telegram/bot/types/input_media.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + InputMedia = ( + InputMediaAnimation | + InputMediaDocument | + InputMediaAudio | + InputMediaPhoto | + InputMediaVideo + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/input_media_animation.rb b/lib/telegram/bot/types/input_media_animation.rb index 006bd0f3..47e6e515 100644 --- a/lib/telegram/bot/types/input_media_animation.rb +++ b/lib/telegram/bot/types/input_media_animation.rb @@ -10,6 +10,7 @@ class InputMediaAnimation < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :width, Types::Integer attribute? :height, Types::Integer attribute? :duration, Types::Integer diff --git a/lib/telegram/bot/types/input_media_photo.rb b/lib/telegram/bot/types/input_media_photo.rb index f59e7cb2..c84e0846 100644 --- a/lib/telegram/bot/types/input_media_photo.rb +++ b/lib/telegram/bot/types/input_media_photo.rb @@ -9,6 +9,7 @@ class InputMediaPhoto < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :has_spoiler, Types::Bool end end diff --git a/lib/telegram/bot/types/input_media_video.rb b/lib/telegram/bot/types/input_media_video.rb index aafb8166..594d333d 100644 --- a/lib/telegram/bot/types/input_media_video.rb +++ b/lib/telegram/bot/types/input_media_video.rb @@ -10,6 +10,7 @@ class InputMediaVideo < Base attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::Bool attribute? :width, Types::Integer attribute? :height, Types::Integer attribute? :duration, Types::Integer diff --git a/lib/telegram/bot/types/input_message_content.rb b/lib/telegram/bot/types/input_message_content.rb index e53de3c9..ad2f5def 100644 --- a/lib/telegram/bot/types/input_message_content.rb +++ b/lib/telegram/bot/types/input_message_content.rb @@ -3,8 +3,16 @@ module Telegram module Bot module Types - class InputMessageContent < Base - end + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + InputMessageContent = ( + InputTextMessageContent | + InputLocationMessageContent | + InputVenueMessageContent | + InputContactMessageContent | + InputInvoiceMessageContent + ) + # rubocop:enable Naming/ConstantName end end end diff --git a/lib/telegram/bot/types/input_paid_media.rb b/lib/telegram/bot/types/input_paid_media.rb new file mode 100644 index 00000000..703457da --- /dev/null +++ b/lib/telegram/bot/types/input_paid_media.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + InputPaidMedia = ( + InputPaidMediaPhoto | + InputPaidMediaVideo + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/input_paid_media_photo.rb b/lib/telegram/bot/types/input_paid_media_photo.rb new file mode 100644 index 00000000..24bfdb43 --- /dev/null +++ b/lib/telegram/bot/types/input_paid_media_photo.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class InputPaidMediaPhoto < Base + attribute :type, Types::String.constrained(eql: 'photo').default('photo') + attribute :media, Types::String + end + end + end +end diff --git a/lib/telegram/bot/types/input_paid_media_video.rb b/lib/telegram/bot/types/input_paid_media_video.rb new file mode 100644 index 00000000..bf50aaad --- /dev/null +++ b/lib/telegram/bot/types/input_paid_media_video.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class InputPaidMediaVideo < Base + attribute :type, Types::String.constrained(eql: 'video').default('video') + attribute :media, Types::String + attribute? :thumbnail, Types::String + attribute? :width, Types::Integer + attribute? :height, Types::Integer + attribute? :duration, Types::Integer + attribute? :supports_streaming, Types::Bool + end + end + end +end diff --git a/lib/telegram/bot/types/input_poll_option.rb b/lib/telegram/bot/types/input_poll_option.rb new file mode 100644 index 00000000..84182322 --- /dev/null +++ b/lib/telegram/bot/types/input_poll_option.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class InputPollOption < Base + attribute :text, Types::String.constrained(min_size: 1, max_size: 100) + attribute? :text_parse_mode, Types::String + attribute? :text_entities, Types::Array.of(MessageEntity) + end + end + end +end diff --git a/lib/telegram/bot/types/input_sticker.rb b/lib/telegram/bot/types/input_sticker.rb new file mode 100644 index 00000000..914de7f1 --- /dev/null +++ b/lib/telegram/bot/types/input_sticker.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class InputSticker < Base + attribute :sticker, Types::String + attribute :format, Types::String + attribute :emoji_list, Types::Array.of(Types::String) + attribute? :mask_position, MaskPosition + attribute? :keywords, Types::Array.of(Types::String) + end + end + end +end diff --git a/lib/telegram/bot/types/input_text_message_content.rb b/lib/telegram/bot/types/input_text_message_content.rb index 8c02dcf2..6c6983d2 100644 --- a/lib/telegram/bot/types/input_text_message_content.rb +++ b/lib/telegram/bot/types/input_text_message_content.rb @@ -3,8 +3,8 @@ module Telegram module Bot module Types - class InputTextMessageContent < InputMessageContent - attribute :message_text, Types::String + class InputTextMessageContent < Base + attribute :message_text, Types::String.constrained(min_size: 1, max_size: 4096) attribute? :parse_mode, Types::String attribute? :entities, Types::Array.of(MessageEntity) attribute? :link_preview_options, LinkPreviewOptions diff --git a/lib/telegram/bot/types/input_venue_message_content.rb b/lib/telegram/bot/types/input_venue_message_content.rb index 9cc9b2b3..176855d3 100644 --- a/lib/telegram/bot/types/input_venue_message_content.rb +++ b/lib/telegram/bot/types/input_venue_message_content.rb @@ -3,7 +3,7 @@ module Telegram module Bot module Types - class InputVenueMessageContent < InputMessageContent + class InputVenueMessageContent < Base attribute :latitude, Types::Float attribute :longitude, Types::Float attribute :title, Types::String diff --git a/lib/telegram/bot/types/keyboard_button_request_chat.rb b/lib/telegram/bot/types/keyboard_button_request_chat.rb index cafe90e8..1974c6ba 100644 --- a/lib/telegram/bot/types/keyboard_button_request_chat.rb +++ b/lib/telegram/bot/types/keyboard_button_request_chat.rb @@ -12,6 +12,9 @@ class KeyboardButtonRequestChat < Base attribute? :user_administrator_rights, ChatAdministratorRights attribute? :bot_administrator_rights, ChatAdministratorRights attribute? :bot_is_member, Types::Bool + attribute? :request_title, Types::Bool + attribute? :request_username, Types::Bool + attribute? :request_photo, Types::Bool end end end diff --git a/lib/telegram/bot/types/keyboard_button_request_users.rb b/lib/telegram/bot/types/keyboard_button_request_users.rb index 3b950358..83c13099 100644 --- a/lib/telegram/bot/types/keyboard_button_request_users.rb +++ b/lib/telegram/bot/types/keyboard_button_request_users.rb @@ -8,6 +8,9 @@ class KeyboardButtonRequestUsers < Base attribute? :user_is_bot, Types::Bool attribute? :user_is_premium, Types::Bool attribute? :max_quantity, Types::Integer.default(1) + attribute? :request_name, Types::Bool + attribute? :request_username, Types::Bool + attribute? :request_photo, Types::Bool end end end diff --git a/lib/telegram/bot/types/location.rb b/lib/telegram/bot/types/location.rb index 3a8eb00c..52c22020 100644 --- a/lib/telegram/bot/types/location.rb +++ b/lib/telegram/bot/types/location.rb @@ -4,8 +4,8 @@ module Telegram module Bot module Types class Location < Base - attribute :longitude, Types::Float attribute :latitude, Types::Float + attribute :longitude, Types::Float attribute? :horizontal_accuracy, Types::Float attribute? :live_period, Types::Integer attribute? :heading, Types::Integer diff --git a/lib/telegram/bot/types/maybe_inaccessible_message.rb b/lib/telegram/bot/types/maybe_inaccessible_message.rb index 3380b0d2..02597023 100644 --- a/lib/telegram/bot/types/maybe_inaccessible_message.rb +++ b/lib/telegram/bot/types/maybe_inaccessible_message.rb @@ -3,10 +3,13 @@ module Telegram module Bot module Types - MaybeInaccessibleMessage = ( # rubocop:disable Naming/ConstantName + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + MaybeInaccessibleMessage = ( Message | InaccessibleMessage ) + # rubocop:enable Naming/ConstantName end end end diff --git a/lib/telegram/bot/types/menu_button.rb b/lib/telegram/bot/types/menu_button.rb new file mode 100644 index 00000000..d0c06ee3 --- /dev/null +++ b/lib/telegram/bot/types/menu_button.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + MenuButton = ( + MenuButtonCommands | + MenuButtonWebApp | + MenuButtonDefault + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/message.rb b/lib/telegram/bot/types/message.rb index 8de0349d..0bfd5d68 100644 --- a/lib/telegram/bot/types/message.rb +++ b/lib/telegram/bot/types/message.rb @@ -8,7 +8,10 @@ class Message < Base attribute? :message_thread_id, Types::Integer attribute? :from, User attribute? :sender_chat, Chat + attribute? :sender_boost_count, Types::Integer + attribute? :sender_business_bot, User attribute :date, Types::Integer + attribute? :business_connection_id, Types::String attribute :chat, Chat attribute? :forward_origin, MessageOrigin attribute? :is_topic_message, Types::True @@ -16,17 +19,21 @@ class Message < Base attribute? :reply_to_message, Message attribute? :external_reply, ExternalReplyInfo attribute? :quote, TextQuote + attribute? :reply_to_story, Story attribute? :via_bot, User attribute? :edit_date, Types::Integer attribute? :has_protected_content, Types::True + attribute? :is_from_offline, Types::True attribute? :media_group_id, Types::String attribute? :author_signature, Types::String attribute? :text, Types::String attribute? :entities, Types::Array.of(MessageEntity) attribute? :link_preview_options, LinkPreviewOptions + attribute? :effect_id, Types::String attribute? :animation, Animation attribute? :audio, Audio attribute? :document, Document + attribute? :paid_media, PaidMediaInfo attribute? :photo, Types::Array.of(PhotoSize) attribute? :sticker, Sticker attribute? :story, Story @@ -35,6 +42,7 @@ class Message < Base attribute? :voice, Voice attribute? :caption, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) + attribute? :show_caption_above_media, Types::True attribute? :has_media_spoiler, Types::True attribute? :contact, Contact attribute? :dice, Dice @@ -56,12 +64,15 @@ class Message < Base attribute? :pinned_message, MaybeInaccessibleMessage attribute? :invoice, Invoice attribute? :successful_payment, SuccessfulPayment + attribute? :refunded_payment, RefundedPayment attribute? :users_shared, UsersShared attribute? :chat_shared, ChatShared attribute? :connected_website, Types::String attribute? :write_access_allowed, WriteAccessAllowed attribute? :passport_data, PassportData attribute? :proximity_alert_triggered, ProximityAlertTriggered + attribute? :boost_added, ChatBoostAdded + attribute? :chat_background_set, ChatBackground attribute? :forum_topic_created, ForumTopicCreated attribute? :forum_topic_edited, ForumTopicEdited attribute? :forum_topic_closed, ForumTopicClosed diff --git a/lib/telegram/bot/types/message_origin.rb b/lib/telegram/bot/types/message_origin.rb index a3a89137..aaa4b014 100644 --- a/lib/telegram/bot/types/message_origin.rb +++ b/lib/telegram/bot/types/message_origin.rb @@ -3,12 +3,15 @@ module Telegram module Bot module Types - MessageOrigin = ( # rubocop:disable Naming/ConstantName + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + MessageOrigin = ( MessageOriginUser | MessageOriginHiddenUser | MessageOriginChat | MessageOriginChannel ) + # rubocop:enable Naming/ConstantName end end end diff --git a/lib/telegram/bot/types/paid_media.rb b/lib/telegram/bot/types/paid_media.rb new file mode 100644 index 00000000..eea7374d --- /dev/null +++ b/lib/telegram/bot/types/paid_media.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + PaidMedia = ( + PaidMediaPreview | + PaidMediaPhoto | + PaidMediaVideo + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/paid_media_info.rb b/lib/telegram/bot/types/paid_media_info.rb new file mode 100644 index 00000000..36861876 --- /dev/null +++ b/lib/telegram/bot/types/paid_media_info.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class PaidMediaInfo < Base + attribute :star_count, Types::Integer + attribute :paid_media, Types::Array.of(PaidMedia) + end + end + end +end diff --git a/lib/telegram/bot/types/paid_media_photo.rb b/lib/telegram/bot/types/paid_media_photo.rb new file mode 100644 index 00000000..bf257c68 --- /dev/null +++ b/lib/telegram/bot/types/paid_media_photo.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class PaidMediaPhoto < Base + attribute :type, Types::String.constrained(eql: 'photo').default('photo') + attribute :photo, Types::Array.of(PhotoSize) + end + end + end +end diff --git a/lib/telegram/bot/types/paid_media_preview.rb b/lib/telegram/bot/types/paid_media_preview.rb new file mode 100644 index 00000000..045bf73c --- /dev/null +++ b/lib/telegram/bot/types/paid_media_preview.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class PaidMediaPreview < Base + attribute :type, Types::String.constrained(eql: 'preview').default('preview') + attribute? :width, Types::Integer + attribute? :height, Types::Integer + attribute? :duration, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/paid_media_purchased.rb b/lib/telegram/bot/types/paid_media_purchased.rb new file mode 100644 index 00000000..d5435d3c --- /dev/null +++ b/lib/telegram/bot/types/paid_media_purchased.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class PaidMediaPurchased < Base + attribute :from, User + attribute :paid_media_payload, Types::String + end + end + end +end diff --git a/lib/telegram/bot/types/paid_media_video.rb b/lib/telegram/bot/types/paid_media_video.rb new file mode 100644 index 00000000..564f3c05 --- /dev/null +++ b/lib/telegram/bot/types/paid_media_video.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class PaidMediaVideo < Base + attribute :type, Types::String.constrained(eql: 'video').default('video') + attribute :video, Video + end + end + end +end diff --git a/lib/telegram/bot/types/passport_element_error.rb b/lib/telegram/bot/types/passport_element_error.rb new file mode 100644 index 00000000..6820c0b6 --- /dev/null +++ b/lib/telegram/bot/types/passport_element_error.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + PassportElementError = ( + PassportElementErrorDataField | + PassportElementErrorFrontSide | + PassportElementErrorReverseSide | + PassportElementErrorSelfie | + PassportElementErrorFile | + PassportElementErrorFiles | + PassportElementErrorTranslationFile | + PassportElementErrorTranslationFiles | + PassportElementErrorUnspecified + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/poll.rb b/lib/telegram/bot/types/poll.rb index 70b6294a..53d563a6 100644 --- a/lib/telegram/bot/types/poll.rb +++ b/lib/telegram/bot/types/poll.rb @@ -5,7 +5,8 @@ module Bot module Types class Poll < Base attribute :id, Types::String - attribute :question, Types::String + attribute :question, Types::String.constrained(min_size: 1, max_size: 300) + attribute? :question_entities, Types::Array.of(MessageEntity) attribute :options, Types::Array.of(PollOption) attribute :total_voter_count, Types::Integer attribute :is_closed, Types::Bool diff --git a/lib/telegram/bot/types/poll_option.rb b/lib/telegram/bot/types/poll_option.rb index 80e280ae..d5eee790 100644 --- a/lib/telegram/bot/types/poll_option.rb +++ b/lib/telegram/bot/types/poll_option.rb @@ -4,7 +4,8 @@ module Telegram module Bot module Types class PollOption < Base - attribute :text, Types::String + attribute :text, Types::String.constrained(min_size: 1, max_size: 100) + attribute? :text_entities, Types::Array.of(MessageEntity) attribute :voter_count, Types::Integer end end diff --git a/lib/telegram/bot/types/prepared_inline_message.rb b/lib/telegram/bot/types/prepared_inline_message.rb new file mode 100644 index 00000000..fdb4f5d7 --- /dev/null +++ b/lib/telegram/bot/types/prepared_inline_message.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class PreparedInlineMessage < Base + attribute :id, Types::String + attribute :expiration_date, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/reaction_type.rb b/lib/telegram/bot/types/reaction_type.rb index 50203e5a..ed088f79 100644 --- a/lib/telegram/bot/types/reaction_type.rb +++ b/lib/telegram/bot/types/reaction_type.rb @@ -3,10 +3,14 @@ module Telegram module Bot module Types - ReactionType = ( # rubocop:disable Naming/ConstantName + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + ReactionType = ( ReactionTypeEmoji | - ReactionTypeCustomEmoji + ReactionTypeCustomEmoji | + ReactionTypePaid ) + # rubocop:enable Naming/ConstantName end end end diff --git a/lib/telegram/bot/types/reaction_type_paid.rb b/lib/telegram/bot/types/reaction_type_paid.rb new file mode 100644 index 00000000..d57eaa62 --- /dev/null +++ b/lib/telegram/bot/types/reaction_type_paid.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class ReactionTypePaid < Base + attribute :type, Types::String.constrained(eql: 'paid').default('paid') + end + end + end +end diff --git a/lib/telegram/bot/types/refunded_payment.rb b/lib/telegram/bot/types/refunded_payment.rb new file mode 100644 index 00000000..c33b2489 --- /dev/null +++ b/lib/telegram/bot/types/refunded_payment.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class RefundedPayment < Base + attribute :currency, Types::String.constrained(eql: 'XTR').default('XTR') + attribute :total_amount, Types::Integer + attribute :invoice_payload, Types::String + attribute :telegram_payment_charge_id, Types::String + attribute? :provider_payment_charge_id, Types::String + end + end + end +end diff --git a/lib/telegram/bot/types/reply_keyboard_markup.rb b/lib/telegram/bot/types/reply_keyboard_markup.rb index f44a5b4b..afddecc0 100644 --- a/lib/telegram/bot/types/reply_keyboard_markup.rb +++ b/lib/telegram/bot/types/reply_keyboard_markup.rb @@ -8,8 +8,8 @@ class ReplyKeyboardMarkup < Base attribute? :is_persistent, Types::Bool.default(false) attribute? :resize_keyboard, Types::Bool.default(false) attribute? :one_time_keyboard, Types::Bool.default(false) - attribute? :input_field_placeholder, Types::String - attribute? :selective, Types::Bool.default(false) + attribute? :input_field_placeholder, Types::String.constrained(min_size: 1, max_size: 64) + attribute? :selective, Types::Bool def to_compact_hash hsh = super diff --git a/lib/telegram/bot/types/reply_keyboard_remove.rb b/lib/telegram/bot/types/reply_keyboard_remove.rb index d45e4075..277f9379 100644 --- a/lib/telegram/bot/types/reply_keyboard_remove.rb +++ b/lib/telegram/bot/types/reply_keyboard_remove.rb @@ -5,7 +5,7 @@ module Bot module Types class ReplyKeyboardRemove < Base attribute :remove_keyboard, Types::True - attribute? :selective, Types::Bool.default(false) + attribute? :selective, Types::Bool end end end diff --git a/lib/telegram/bot/types/response_parameters.rb b/lib/telegram/bot/types/response_parameters.rb new file mode 100644 index 00000000..c80cc54c --- /dev/null +++ b/lib/telegram/bot/types/response_parameters.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class ResponseParameters < Base + attribute? :migrate_to_chat_id, Types::Integer + attribute? :retry_after, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/revenue_withdrawal_state.rb b/lib/telegram/bot/types/revenue_withdrawal_state.rb new file mode 100644 index 00000000..9533814a --- /dev/null +++ b/lib/telegram/bot/types/revenue_withdrawal_state.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + RevenueWithdrawalState = ( + RevenueWithdrawalStatePending | + RevenueWithdrawalStateSucceeded | + RevenueWithdrawalStateFailed + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/revenue_withdrawal_state_failed.rb b/lib/telegram/bot/types/revenue_withdrawal_state_failed.rb new file mode 100644 index 00000000..6321dd96 --- /dev/null +++ b/lib/telegram/bot/types/revenue_withdrawal_state_failed.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class RevenueWithdrawalStateFailed < Base + attribute :type, Types::String.constrained(eql: 'failed').default('failed') + end + end + end +end diff --git a/lib/telegram/bot/types/revenue_withdrawal_state_pending.rb b/lib/telegram/bot/types/revenue_withdrawal_state_pending.rb new file mode 100644 index 00000000..dac7b0d4 --- /dev/null +++ b/lib/telegram/bot/types/revenue_withdrawal_state_pending.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class RevenueWithdrawalStatePending < Base + attribute :type, Types::String.constrained(eql: 'pending').default('pending') + end + end + end +end diff --git a/lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb b/lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb new file mode 100644 index 00000000..2995c0c2 --- /dev/null +++ b/lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class RevenueWithdrawalStateSucceeded < Base + attribute :type, Types::String.constrained(eql: 'succeeded').default('succeeded') + attribute :date, Types::Integer + attribute :url, Types::String + end + end + end +end diff --git a/lib/telegram/bot/types/shared_user.rb b/lib/telegram/bot/types/shared_user.rb new file mode 100644 index 00000000..c59a184c --- /dev/null +++ b/lib/telegram/bot/types/shared_user.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class SharedUser < Base + attribute :user_id, Types::Integer + attribute? :first_name, Types::String + attribute? :last_name, Types::String + attribute? :username, Types::String + attribute? :photo, Types::Array.of(PhotoSize) + end + end + end +end diff --git a/lib/telegram/bot/types/star_transaction.rb b/lib/telegram/bot/types/star_transaction.rb new file mode 100644 index 00000000..60ff332b --- /dev/null +++ b/lib/telegram/bot/types/star_transaction.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class StarTransaction < Base + attribute :id, Types::String + attribute :amount, Types::Integer + attribute :date, Types::Integer + attribute? :source, TransactionPartner + attribute? :receiver, TransactionPartner + end + end + end +end diff --git a/lib/telegram/bot/types/star_transactions.rb b/lib/telegram/bot/types/star_transactions.rb new file mode 100644 index 00000000..b781bbb9 --- /dev/null +++ b/lib/telegram/bot/types/star_transactions.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class StarTransactions < Base + attribute :transactions, Types::Array.of(StarTransaction) + end + end + end +end diff --git a/lib/telegram/bot/types/sticker_set.rb b/lib/telegram/bot/types/sticker_set.rb index 4c397480..c22d14d8 100644 --- a/lib/telegram/bot/types/sticker_set.rb +++ b/lib/telegram/bot/types/sticker_set.rb @@ -7,8 +7,6 @@ class StickerSet < Base attribute :name, Types::String attribute :title, Types::String attribute :sticker_type, Types::String - attribute :is_animated, Types::Bool - attribute :is_video, Types::Bool attribute :stickers, Types::Array.of(Sticker) attribute? :thumbnail, PhotoSize end diff --git a/lib/telegram/bot/types/story.rb b/lib/telegram/bot/types/story.rb index bc41a5bb..9005d821 100644 --- a/lib/telegram/bot/types/story.rb +++ b/lib/telegram/bot/types/story.rb @@ -3,7 +3,10 @@ module Telegram module Bot module Types - class Story < Base; end + class Story < Base + attribute :chat, Chat + attribute :id, Types::Integer + end end end end diff --git a/lib/telegram/bot/types/successful_payment.rb b/lib/telegram/bot/types/successful_payment.rb index e6ef3106..2084863b 100644 --- a/lib/telegram/bot/types/successful_payment.rb +++ b/lib/telegram/bot/types/successful_payment.rb @@ -7,6 +7,9 @@ class SuccessfulPayment < Base attribute :currency, Types::String attribute :total_amount, Types::Integer attribute :invoice_payload, Types::String + attribute? :subscription_expiration_date, Types::Integer + attribute? :is_recurring, Types::True + attribute? :is_first_recurring, Types::True attribute? :shipping_option_id, Types::String attribute? :order_info, OrderInfo attribute :telegram_payment_charge_id, Types::String diff --git a/lib/telegram/bot/types/transaction_partner.rb b/lib/telegram/bot/types/transaction_partner.rb new file mode 100644 index 00000000..04177037 --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + TransactionPartner = ( + TransactionPartnerUser | + TransactionPartnerFragment | + TransactionPartnerTelegramAds | + TransactionPartnerTelegramApi | + TransactionPartnerOther + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/lib/telegram/bot/types/transaction_partner_fragment.rb b/lib/telegram/bot/types/transaction_partner_fragment.rb new file mode 100644 index 00000000..029a3d84 --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner_fragment.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class TransactionPartnerFragment < Base + attribute :type, Types::String.constrained(eql: 'fragment').default('fragment') + attribute? :withdrawal_state, RevenueWithdrawalState + end + end + end +end diff --git a/lib/telegram/bot/types/transaction_partner_other.rb b/lib/telegram/bot/types/transaction_partner_other.rb new file mode 100644 index 00000000..f7dfc122 --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner_other.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class TransactionPartnerOther < Base + attribute :type, Types::String.constrained(eql: 'other').default('other') + end + end + end +end diff --git a/lib/telegram/bot/types/transaction_partner_telegram_ads.rb b/lib/telegram/bot/types/transaction_partner_telegram_ads.rb new file mode 100644 index 00000000..955039d9 --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner_telegram_ads.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class TransactionPartnerTelegramAds < Base + attribute :type, Types::String.constrained(eql: 'telegram_ads').default('telegram_ads') + end + end + end +end diff --git a/lib/telegram/bot/types/transaction_partner_telegram_api.rb b/lib/telegram/bot/types/transaction_partner_telegram_api.rb new file mode 100644 index 00000000..0ca38e1b --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner_telegram_api.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class TransactionPartnerTelegramApi < Base + attribute :type, Types::String.constrained(eql: 'telegram_api').default('telegram_api') + attribute :request_count, Types::Integer + end + end + end +end diff --git a/lib/telegram/bot/types/transaction_partner_user.rb b/lib/telegram/bot/types/transaction_partner_user.rb new file mode 100644 index 00000000..ed744129 --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner_user.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class TransactionPartnerUser < Base + attribute :type, Types::String.constrained(eql: 'user').default('user') + attribute :user, User + attribute? :invoice_payload, Types::String + attribute? :subscription_period, Types::Integer + attribute? :paid_media, Types::Array.of(PaidMedia) + attribute? :paid_media_payload, Types::String + attribute? :gift, Gift + end + end + end +end diff --git a/lib/telegram/bot/types/update.rb b/lib/telegram/bot/types/update.rb index 3b8cf453..f22cd097 100644 --- a/lib/telegram/bot/types/update.rb +++ b/lib/telegram/bot/types/update.rb @@ -9,6 +9,10 @@ class Update < Base attribute? :edited_message, Message attribute? :channel_post, Message attribute? :edited_channel_post, Message + attribute? :business_connection, BusinessConnection + attribute? :business_message, Message + attribute? :edited_business_message, Message + attribute? :deleted_business_messages, BusinessMessagesDeleted attribute? :message_reaction, MessageReactionUpdated attribute? :message_reaction_count, MessageReactionCountUpdated attribute? :inline_query, InlineQuery @@ -16,6 +20,7 @@ class Update < Base attribute? :callback_query, CallbackQuery attribute? :shipping_query, ShippingQuery attribute? :pre_checkout_query, PreCheckoutQuery + attribute? :purchased_paid_media, PaidMediaPurchased attribute? :poll, Poll attribute? :poll_answer, PollAnswer attribute? :my_chat_member, ChatMemberUpdated diff --git a/lib/telegram/bot/types/user.rb b/lib/telegram/bot/types/user.rb index 3cf217e6..63176387 100644 --- a/lib/telegram/bot/types/user.rb +++ b/lib/telegram/bot/types/user.rb @@ -15,6 +15,8 @@ class User < Base attribute? :can_join_groups, Types::Bool attribute? :can_read_all_group_messages, Types::Bool attribute? :supports_inline_queries, Types::Bool + attribute? :can_connect_to_business, Types::Bool + attribute? :has_main_web_app, Types::Bool end end end diff --git a/lib/telegram/bot/types/users_shared.rb b/lib/telegram/bot/types/users_shared.rb index 59d686e9..ffd74861 100644 --- a/lib/telegram/bot/types/users_shared.rb +++ b/lib/telegram/bot/types/users_shared.rb @@ -5,7 +5,7 @@ module Bot module Types class UsersShared < Base attribute :request_id, Types::Integer - attribute :user_ids, Types::Array.of(Types::Integer) + attribute :users, Types::Array.of(SharedUser) end end end diff --git a/lib/telegram/bot/version.rb b/lib/telegram/bot/version.rb index 41b2be53..f8fff785 100644 --- a/lib/telegram/bot/version.rb +++ b/lib/telegram/bot/version.rb @@ -2,6 +2,6 @@ module Telegram module Bot - VERSION = '2.0.0' + VERSION = '2.1.0' end end diff --git a/rakelib/parse_schema.rake b/rakelib/parse_schema.rake new file mode 100644 index 00000000..7025a181 --- /dev/null +++ b/rakelib/parse_schema.rake @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +require 'openapi3_parser' + +desc 'Parse types from public json, should be up to date https://github.com/ark0f/tg-bot-api' +task :parse_schema do + document = Openapi3Parser.load_url('https://ark0f.github.io/tg-bot-api/openapi.json') + + result = document.components.schemas.to_h do |type_name, schema| + type_schema = schema.properties.to_h do |property_name, property_schema| + attribute = { type: parse_initial_type(property_schema, property_name) } + + unless property_schema.any_of.nil? + attribute[:type] = property_schema.any_of.map { |item| property_schema.name || item.name || item.type }.uniq + end + + # Input File is literally just a string for our purpose + attribute[:type]&.delete('InputFile') + attribute[:type] = attribute[:type].join if attribute[:type]&.length == 1 + + attribute[:required] = true if required_keys(schema).include?(property_name) + + # getting required values from the description, no values in json 😔 + required_value = property_schema.description&.match(/always “(.+)”|must be \*(.+)\*/) + attribute[:required_value] = (required_value[1] || required_value[2]).delete('\\') if required_value + + # for some reason every property's minLength is 0 by default, probably parser bug, had to ignore that + attribute[:min_size] = property_schema[:minLength] if property_schema[:minLength] != 0 + attribute[:max_size] = property_schema[:maxLength] if property_schema[:maxLength] + + attribute[:items] = property_schema.items.type if property_schema&.items + if property_schema&.type == 'array' && property_schema&.items&.type.nil? + attribute[:items] = property_schema&.items&.name + end + + attribute[:items] = property_schema.items.name if property_schema&.items&.type == 'object' + + # array of arrays + if property_schema&.items&.type == 'array' + attribute[:items] = { type: 'array', items: property_schema.items.items.name } + end + + attribute = apply_default_schema(attribute, property_schema) + [property_name, attribute] + end + + # find empty classes + type_schema[:type] = schema.any_of.map(&:name) if schema.properties.empty? && schema.any_of + [type_name, type_schema] + end + + # Input File is literally just a string for our purpose + File.write "#{__dir__}/../utility/type_attributes.json", JSON.pretty_generate(result.except('InputFile')) +end + +def required_keys(schema) + schema.required.to_a || [] +end + +def apply_default_schema(attribute, property_schema) + attribute[:default] = property_schema.default unless property_schema.default.nil? + # previous line would have been enough, but had to check the description due to issue: https://github.com/kevindew/openapi3_parser/issues/28 + attribute[:default] = false if property_schema.description&.include?('Defaults to *false*') + attribute +end + +def parse_initial_type(property_schema, property_name) + case property_schema.type + when nil then property_name.capitalize.gsub(/_(\w)/) { Regexp.last_match(1).upcase } + when 'object' then property_schema.name + else property_schema.type + end +end diff --git a/rakelib/rebuild_types.rake b/rakelib/rebuild_types.rake new file mode 100644 index 00000000..62660dfd --- /dev/null +++ b/rakelib/rebuild_types.rake @@ -0,0 +1,90 @@ +# frozen_string_literal: true + +require 'json' +require 'erb' +DRY_TYPES = %w[string integer float decimal array hash symbol boolean date date_time time range].freeze + +desc 'Rebuild types' +task :rebuild_types do + types = JSON.parse(File.read("#{__dir__}/../utility/type_attributes.json"), symbolize_names: true) + + types.each_pair do |name, attributes| + next build_empty_type(name, attributes) if attributes[:type].instance_of?(Array) + + attributes.each_pair do |attr_name, properties| + attributes[attr_name][:type] = add_module_types(properties[:type]) unless properties[:type].is_a?(Array) + if properties[:type].is_a?(Array) + attributes[attr_name][:type] = properties[:type].map do |type| + add_module_types(type) + end.join(' | ') + end + + if properties[:items].instance_of?(String) + attributes[attr_name][:type] += ".of(#{add_module_types(properties[:items])})" + elsif properties[:items] && properties[:items][:type] == 'array' + attributes[attr_name][:type] += ".of(Types::Array.of(#{properties[:items][:items]}))" + end + original_type = properties[:type] + + attributes = apply_required(attributes, attr_name, properties, original_type) + attributes = apply_min_max(attributes, attr_name, properties) + attributes = apply_default(attributes, attr_name, properties, original_type) + + attributes[attr_name][:type] = 'Types::True' if attributes[attr_name][:type] == 'Types::Boolean.default(true)' + attributes[attr_name][:type] = attributes[attr_name][:type].gsub('Types::Boolean', 'Types::Bool') + end + + File.write "#{__dir__}/../lib/telegram/bot/types/#{underscore(name)}.rb", + ERB.new(File.read("#{__dir__}/../utility/type.erb")).result(binding).gsub(" \n", '') + end +end + +def build_empty_type(name, attributes) + attributes = attributes[:type].join(" |\n ") + File.write "#{__dir__}/../lib/telegram/bot/types/#{underscore(name)}.rb", + ERB.new(File.read("#{__dir__}/../utility/empty_type.erb")).result(binding).gsub(" \n", '') +end + +def apply_default(attributes, attr_name, properties, original_type) + return attributes if properties[:default].nil? + + attributes[attr_name][:type] += ".default(#{typecast(original_type, + properties[:default])})" + attributes +end + +def apply_required(attributes, attr_name, properties, original_type) + return attributes unless properties[:required_value] + + attributes[attr_name][:type] += ".constrained(eql: #{typecast(original_type, + properties[:required_value])})" + attributes +end + +def apply_min_max(attributes, attr_name, properties) + return attributes unless properties[:min_size] || properties[:max_size] + + constrain = '.constrained(minmax)' + constrain = properties[:min_size] ? constrain.gsub('min', "min_size: #{properties[:min_size]}, ") : '' + constrain = constrain.gsub('max', "max_size: #{properties[:max_size]}") if properties[:max_size] + attributes[attr_name][:type] += constrain + attributes +end + +def add_module_types(type) + return 'Types::Float' if type == 'number' + + DRY_TYPES.include?(type) ? "Types::#{type.capitalize}" : type +end + +def underscore(camel_cased_word) + camel_cased_word.to_s.gsub('::', '/') + .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') + .gsub(/([a-z\d])([A-Z])/, '\1_\2') + .tr('-', '_') + .downcase +end + +def typecast(type, obj) + type == 'Types::String' ? "'#{obj}'" : obj +end diff --git a/spec/lib/telegram/bot/types_spec.rb b/spec/lib/telegram/bot/types_spec.rb index 72004295..0b1d5000 100644 --- a/spec/lib/telegram/bot/types_spec.rb +++ b/spec/lib/telegram/bot/types_spec.rb @@ -1,84 +1,20 @@ # frozen_string_literal: true -require 'yaml' +require 'json' -type_attributes = YAML.safe_load File.read("#{__dir__}/../../../support/type_attributes.yml") +file = File.read("#{__dir__}/../../../../utility/type_attributes.json") +parsed_types = JSON.parse(file) RSpec.describe Telegram::Bot::Types do - type_attributes.each do |parsed_type, parsed_attributes| - describe parsed_type do - subject(:klass) { described_class.const_get(parsed_type, false) } + parsed_types.each do |class_name, attributes| + describe class_name do + subject(:klass) { described_class.const_get(class_name, false) } - it 'has correct attributes' do - expect(klass.schema.keys.map(&:name)).to eq(parsed_attributes.map { |e| e['name'].to_sym }) - end - - parsed_attributes.each do |parsed_attribute| - describe "##{parsed_attribute['name']}" do - subject(:klass_attribute) { klass.schema.name_key_map[parsed_attribute['name'].to_sym] } - - describe 'type' do - subject do - klass_attribute_type = klass_attribute&.type - - ## We need to get rid of `default` values - ## https://discourse.dry-rb.org/t/how-to-remove-a-default-from-dry-types-custom-class-attribute/1727 - klass_attribute_type = klass_attribute_type.type if klass_attribute_type.default? - - klass_attribute_type - end - - def parse_string_type(type_string) - if (match_data = type_string.match(/^Array of (?.+)$/)) - ## Call a recursion for `Array of Array of Something` - return described_class::Array.of(send(__method__, match_data[:inner_type])) - end - - ## We have no examples of `or` with 3 or more types - if (match_data = type_string.match(/^(\w+) or (\w+)$/)) - ## `uniq` for `InputFile`, for example - return match_data[1..].map { |matched_type| send(__method__, matched_type) }.uniq.reduce(:|) - end - - type_string = - case type_string - ## `dry-types` has no `Boolean` type (or alias) - when 'Boolean' then 'Bool' - when 'Float number' then 'Float' - ## It's a `file_id`, URL or `multipart/form-data`: - ## https://core.telegram.org/bots/api#inputfile - when 'InputFile' then 'String' - ## I'm not sure about this. It's like "True is optional to send" and "We can response with False" - # when 'True' && !parsed_attribute['required'] then 'Boolean' - else type_string - end + # empty classes exception + next if described_class.const_get(class_name, false).instance_of?(Dry::Struct::Sum) - # binding.irb if type_string == 'Bool' - - ## Without `false` for `const_get` because base types inhereted from the `dry-types` - described_class.const_get(type_string) - end - - let(:expected_type) do - result = parse_string_type(parsed_attribute['type']) - - ## Sometimes there are required values for attributes, like `BotCommandScope` or `MenuButton` - if (required_value = parsed_attribute['required_value']) - result = result.constrained(eql: required_value) - end - - result - end - - it { is_expected.to eq expected_type } - end - - describe 'optionality' do - subject { klass_attribute&.required? } - - it { is_expected.to eq parsed_attribute['required'] } - end - end + it 'has correct attributes' do + expect(klass.schema.keys.map(&:name)).to eq(attributes.keys.map(&:to_sym)) end end end diff --git a/spec/support/type_attributes.yml b/spec/support/type_attributes.yml deleted file mode 100644 index b6436220..00000000 --- a/spec/support/type_attributes.yml +++ /dev/null @@ -1,3278 +0,0 @@ ---- -ShippingOption: -- name: id - type: String - required: true -- name: title - type: String - required: true -- name: prices - type: Array of LabeledPrice - required: true -ReplyParameters: -- name: message_id - type: Integer - required: true -- name: chat_id - type: Integer or String - required: false -- name: allow_sending_without_reply - type: Boolean - required: false -- name: quote - type: String - required: false -- name: quote_parse_mode - type: String - required: false -- name: quote_entities - type: Array of MessageEntity - required: false -- name: quote_position - type: Integer - required: false -ReplyKeyboardRemove: -- name: remove_keyboard - type: 'True' - required: true -- name: selective - type: Boolean - required: false -ReplyKeyboardMarkup: -- name: keyboard - type: Array of Array of KeyboardButton - required: true -- name: is_persistent - type: Boolean - required: false -- name: resize_keyboard - type: Boolean - required: false -- name: one_time_keyboard - type: Boolean - required: false -- name: input_field_placeholder - type: String - required: false -- name: selective - type: Boolean - required: false -PassportElementErrorUnspecified: -- name: source - type: String - required: true - required_value: unspecified -- name: type - type: String - required: true -- name: element_hash - type: String - required: true -- name: message - type: String - required: true -PassportElementErrorTranslationFiles: -- name: source - type: String - required: true - required_value: translation_files -- name: type - type: String - required: true -- name: file_hashes - type: Array of String - required: true -- name: message - type: String - required: true -PassportElementErrorTranslationFile: -- name: source - type: String - required: true - required_value: translation_file -- name: type - type: String - required: true -- name: file_hash - type: String - required: true -- name: message - type: String - required: true -PassportElementErrorSelfie: -- name: source - type: String - required: true - required_value: selfie -- name: type - type: String - required: true -- name: file_hash - type: String - required: true -- name: message - type: String - required: true -PassportElementErrorReverseSide: -- name: source - type: String - required: true - required_value: reverse_side -- name: type - type: String - required: true -- name: file_hash - type: String - required: true -- name: message - type: String - required: true -PassportElementErrorFrontSide: -- name: source - type: String - required: true - required_value: front_side -- name: type - type: String - required: true -- name: file_hash - type: String - required: true -- name: message - type: String - required: true -PassportElementErrorFiles: -- name: source - type: String - required: true - required_value: files -- name: type - type: String - required: true -- name: file_hashes - type: Array of String - required: true -- name: message - type: String - required: true -PassportElementErrorFile: -- name: source - type: String - required: true - required_value: file -- name: type - type: String - required: true -- name: file_hash - type: String - required: true -- name: message - type: String - required: true -PassportElementErrorDataField: -- name: source - type: String - required: true - required_value: data -- name: type - type: String - required: true -- name: field_name - type: String - required: true -- name: data_hash - type: String - required: true -- name: message - type: String - required: true -KeyboardButtonPollType: -- name: type - type: String - required: false -KeyboardButtonRequestChat: -- name: request_id - type: Integer - required: true -- name: chat_is_channel - type: Boolean - required: true -- name: chat_is_forum - type: Boolean - required: false -- name: chat_has_username - type: Boolean - required: false -- name: chat_is_created - type: Boolean - required: false -- name: user_administrator_rights - type: ChatAdministratorRights - required: false -- name: bot_administrator_rights - type: ChatAdministratorRights - required: false -- name: bot_is_member - type: Boolean - required: false -KeyboardButtonRequestUsers: -- name: request_id - type: Integer - required: true -- name: user_is_bot - type: Boolean - required: false -- name: user_is_premium - type: Boolean - required: false -- name: max_quantity - type: Integer - required: false -KeyboardButton: -- name: text - type: String - required: true -- name: request_users - type: KeyboardButtonRequestUsers - required: false -- name: request_chat - type: KeyboardButtonRequestChat - required: false -- name: request_contact - type: Boolean - required: false -- name: request_location - type: Boolean - required: false -- name: request_poll - type: KeyboardButtonPollType - required: false -- name: web_app - type: WebAppInfo - required: false -InputVenueMessageContent: -- name: latitude - type: Float - required: true -- name: longitude - type: Float - required: true -- name: title - type: String - required: true -- name: address - type: String - required: true -- name: foursquare_id - type: String - required: false -- name: foursquare_type - type: String - required: false -- name: google_place_id - type: String - required: false -- name: google_place_type - type: String - required: false -InputTextMessageContent: -- name: message_text - type: String - required: true -- name: parse_mode - type: String - required: false -- name: entities - type: Array of MessageEntity - required: false -- name: link_preview_options - type: LinkPreviewOptions - required: false -InputMediaVideo: -- name: type - type: String - required: true - required_value: video -- name: media - type: String - required: true -- name: thumbnail - type: InputFile or String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: width - type: Integer - required: false -- name: height - type: Integer - required: false -- name: duration - type: Integer - required: false -- name: supports_streaming - type: Boolean - required: false -- name: has_spoiler - type: Boolean - required: false -InputMediaPhoto: -- name: type - type: String - required: true - required_value: photo -- name: media - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: has_spoiler - type: Boolean - required: false -InputMediaDocument: -- name: type - type: String - required: true - required_value: document -- name: media - type: String - required: true -- name: thumbnail - type: InputFile or String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: disable_content_type_detection - type: Boolean - required: false -InputMediaAudio: -- name: type - type: String - required: true - required_value: audio -- name: media - type: String - required: true -- name: thumbnail - type: InputFile or String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: duration - type: Integer - required: false -- name: performer - type: String - required: false -- name: title - type: String - required: false -InputMediaAnimation: -- name: type - type: String - required: true - required_value: animation -- name: media - type: String - required: true -- name: thumbnail - type: InputFile or String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: width - type: Integer - required: false -- name: height - type: Integer - required: false -- name: duration - type: Integer - required: false -- name: has_spoiler - type: Boolean - required: false -InputLocationMessageContent: -- name: latitude - type: Float - required: true -- name: longitude - type: Float - required: true -- name: horizontal_accuracy - type: Float number - required: false -- name: live_period - type: Integer - required: false -- name: heading - type: Integer - required: false -- name: proximity_alert_radius - type: Integer - required: false -LabeledPrice: -- name: label - type: String - required: true -- name: amount - type: Integer - required: true -InputInvoiceMessageContent: -- name: title - type: String - required: true -- name: description - type: String - required: true -- name: payload - type: String - required: true -- name: provider_token - type: String - required: true -- name: currency - type: String - required: true -- name: prices - type: Array of LabeledPrice - required: true -- name: max_tip_amount - type: Integer - required: false -- name: suggested_tip_amounts - type: Array of Integer - required: false -- name: provider_data - type: String - required: false -- name: photo_url - type: String - required: false -- name: photo_size - type: Integer - required: false -- name: photo_width - type: Integer - required: false -- name: photo_height - type: Integer - required: false -- name: need_name - type: Boolean - required: false -- name: need_phone_number - type: Boolean - required: false -- name: need_email - type: Boolean - required: false -- name: need_shipping_address - type: Boolean - required: false -- name: send_phone_number_to_provider - type: Boolean - required: false -- name: send_email_to_provider - type: Boolean - required: false -- name: is_flexible - type: Boolean - required: false -InputContactMessageContent: -- name: phone_number - type: String - required: true -- name: first_name - type: String - required: true -- name: last_name - type: String - required: false -- name: vcard - type: String - required: false -InlineQueryResultVoice: -- name: type - type: String - required: true - required_value: voice -- name: id - type: String - required: true -- name: voice_url - type: String - required: true -- name: title - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: voice_duration - type: Integer - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultVideo: -- name: type - type: String - required: true - required_value: video -- name: id - type: String - required: true -- name: video_url - type: String - required: true -- name: mime_type - type: String - required: true -- name: thumbnail_url - type: String - required: true -- name: title - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: video_width - type: Integer - required: false -- name: video_height - type: Integer - required: false -- name: video_duration - type: Integer - required: false -- name: description - type: String - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultVenue: -- name: type - type: String - required: true - required_value: venue -- name: id - type: String - required: true -- name: latitude - type: Float - required: true -- name: longitude - type: Float - required: true -- name: title - type: String - required: true -- name: address - type: String - required: true -- name: foursquare_id - type: String - required: false -- name: foursquare_type - type: String - required: false -- name: google_place_id - type: String - required: false -- name: google_place_type - type: String - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -- name: thumbnail_url - type: String - required: false -- name: thumbnail_width - type: Integer - required: false -- name: thumbnail_height - type: Integer - required: false -InlineQueryResultPhoto: -- name: type - type: String - required: true - required_value: photo -- name: id - type: String - required: true -- name: photo_url - type: String - required: true -- name: thumbnail_url - type: String - required: true -- name: photo_width - type: Integer - required: false -- name: photo_height - type: Integer - required: false -- name: title - type: String - required: false -- name: description - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultMpeg4Gif: -- name: type - type: String - required: true - required_value: mpeg4_gif -- name: id - type: String - required: true -- name: mpeg4_url - type: String - required: true -- name: mpeg4_width - type: Integer - required: false -- name: mpeg4_height - type: Integer - required: false -- name: mpeg4_duration - type: Integer - required: false -- name: thumbnail_url - type: String - required: true -- name: thumbnail_mime_type - type: String - required: false -- name: title - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultLocation: -- name: type - type: String - required: true - required_value: location -- name: id - type: String - required: true -- name: latitude - type: Float number - required: true -- name: longitude - type: Float number - required: true -- name: title - type: String - required: true -- name: horizontal_accuracy - type: Float number - required: false -- name: live_period - type: Integer - required: false -- name: heading - type: Integer - required: false -- name: proximity_alert_radius - type: Integer - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -- name: thumbnail_url - type: String - required: false -- name: thumbnail_width - type: Integer - required: false -- name: thumbnail_height - type: Integer - required: false -InlineQueryResultGif: -- name: type - type: String - required: true - required_value: gif -- name: id - type: String - required: true -- name: gif_url - type: String - required: true -- name: gif_width - type: Integer - required: false -- name: gif_height - type: Integer - required: false -- name: gif_duration - type: Integer - required: false -- name: thumbnail_url - type: String - required: true -- name: thumbnail_mime_type - type: String - required: false -- name: title - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultGame: -- name: type - type: String - required: true - required_value: game -- name: id - type: String - required: true -- name: game_short_name - type: String - required: true -- name: reply_markup - type: InlineKeyboardMarkup - required: false -InlineQueryResultDocument: -- name: type - type: String - required: true - required_value: document -- name: id - type: String - required: true -- name: title - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: document_url - type: String - required: true -- name: mime_type - type: String - required: true -- name: description - type: String - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -- name: thumbnail_url - type: String - required: false -- name: thumbnail_width - type: Integer - required: false -- name: thumbnail_height - type: Integer - required: false -InlineQueryResultContact: -- name: type - type: String - required: true - required_value: contact -- name: id - type: String - required: true -- name: phone_number - type: String - required: true -- name: first_name - type: String - required: true -- name: last_name - type: String - required: false -- name: vcard - type: String - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -- name: thumbnail_url - type: String - required: false -- name: thumbnail_width - type: Integer - required: false -- name: thumbnail_height - type: Integer - required: false -InlineQueryResultCachedVoice: -- name: type - type: String - required: true - required_value: voice -- name: id - type: String - required: true -- name: voice_file_id - type: String - required: true -- name: title - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedVideo: -- name: type - type: String - required: true - required_value: video -- name: id - type: String - required: true -- name: video_file_id - type: String - required: true -- name: title - type: String - required: true -- name: description - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedSticker: -- name: type - type: String - required: true - required_value: sticker -- name: id - type: String - required: true -- name: sticker_file_id - type: String - required: true -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedPhoto: -- name: type - type: String - required: true - required_value: photo -- name: id - type: String - required: true -- name: photo_file_id - type: String - required: true -- name: title - type: String - required: false -- name: description - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedMpeg4Gif: -- name: type - type: String - required: true - required_value: mpeg4_gif -- name: id - type: String - required: true -- name: mpeg4_file_id - type: String - required: true -- name: title - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedGif: -- name: type - type: String - required: true - required_value: gif -- name: id - type: String - required: true -- name: gif_file_id - type: String - required: true -- name: title - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedDocument: -- name: type - type: String - required: true - required_value: document -- name: id - type: String - required: true -- name: title - type: String - required: true -- name: document_file_id - type: String - required: true -- name: description - type: String - required: false -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultCachedAudio: -- name: type - type: String - required: true - required_value: audio -- name: id - type: String - required: true -- name: audio_file_id - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InlineQueryResultAudio: -- name: type - type: String - required: true - required_value: audio -- name: id - type: String - required: true -- name: audio_url - type: String - required: true -- name: title - type: String - required: true -- name: caption - type: String - required: false -- name: parse_mode - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: performer - type: String - required: false -- name: audio_duration - type: Integer - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: input_message_content - type: InputMessageContent - required: false -InputMessageContent: [] -InlineQueryResultArticle: -- name: type - type: String - required: true - required_value: article -- name: id - type: String - required: true -- name: title - type: String - required: true -- name: input_message_content - type: InputMessageContent - required: true -- name: reply_markup - type: InlineKeyboardMarkup - required: false -- name: url - type: String - required: false -- name: hide_url - type: Boolean - required: false -- name: description - type: String - required: false -- name: thumbnail_url - type: String - required: false -- name: thumbnail_width - type: Integer - required: false -- name: thumbnail_height - type: Integer - required: false -ForumTopic: -- name: message_thread_id - type: Integer - required: true -- name: name - type: String - required: true -- name: icon_color - type: Integer - required: true -- name: icon_custom_emoji_id - type: String - required: false -ForceReply: -- name: force_reply - type: 'True' - required: true -- name: input_field_placeholder - type: String - required: false -- name: selective - type: Boolean - required: false -BotCommandScopeDefault: -- name: type - type: String - required: true - required_value: default -BotCommandScopeChatMember: -- name: type - type: String - required: true - required_value: chat_member -- name: chat_id - type: Integer or String - required: true -- name: user_id - type: Integer - required: true -BotCommandScopeChatAdministrators: -- name: type - type: String - required: true - required_value: chat_administrators -- name: chat_id - type: Integer or String - required: true -BotCommandScopeChat: -- name: type - type: String - required: true - required_value: chat -- name: chat_id - type: Integer or String - required: true -BotCommandScopeAllPrivateChats: -- name: type - type: String - required: true - required_value: all_private_chats -BotCommandScopeAllGroupChats: -- name: type - type: String - required: true - required_value: all_group_chats -BotCommandScopeAllChatAdministrators: -- name: type - type: String - required: true - required_value: all_chat_administrators -BotShortDescription: -- name: short_description - type: String - required: true -BotDescription: -- name: description - type: String - required: true -BotName: -- name: name - type: String - required: true -ChatAdministratorRights: -- name: is_anonymous - type: Boolean - required: true -- name: can_manage_chat - type: Boolean - required: true -- name: can_delete_messages - type: Boolean - required: true -- name: can_manage_video_chats - type: Boolean - required: true -- name: can_restrict_members - type: Boolean - required: true -- name: can_promote_members - type: Boolean - required: true -- name: can_change_info - type: Boolean - required: true -- name: can_invite_users - type: Boolean - required: true -- name: can_post_messages - type: Boolean - required: false -- name: can_edit_messages - type: Boolean - required: false -- name: can_pin_messages - type: Boolean - required: false -- name: can_post_stories - type: Boolean - required: false -- name: can_edit_stories - type: Boolean - required: false -- name: can_delete_stories - type: Boolean - required: false -- name: can_manage_topics - type: Boolean - required: false -MenuButtonWebApp: -- name: type - type: String - required: true - required_value: web_app -- name: text - type: String - required: true -- name: web_app - type: WebAppInfo - required: true -MenuButtonCommands: -- name: type - type: String - required: true - required_value: commands -MenuButtonDefault: -- name: type - type: String - required: true - required_value: default -SentWebAppMessage: -- name: inline_message_id - type: String - required: false -BotCommand: -- name: command - type: String - required: true -- name: description - type: String - required: true -GameHighScore: -- name: position - type: Integer - required: true -- name: user - type: User - required: true -- name: score - type: Integer - required: true -StickerSet: -- name: name - type: String - required: true -- name: title - type: String - required: true -- name: sticker_type - type: String - required: true -- name: is_animated - type: Boolean - required: true -- name: is_video - type: Boolean - required: true -- name: stickers - type: Array of Sticker - required: true -- name: thumbnail - type: PhotoSize - required: false -UserChatBoosts: -- name: boosts - type: Array of ChatBoost - required: true -UserProfilePhotos: -- name: total_count - type: Integer - required: true -- name: photos - type: Array of Array of PhotoSize - required: true -MessageId: -- name: message_id - type: Integer - required: true -WebhookInfo: -- name: url - type: String - required: true -- name: has_custom_certificate - type: Boolean - required: true -- name: pending_update_count - type: Integer - required: true -- name: ip_address - type: String - required: false -- name: last_error_date - type: Integer - required: false -- name: last_error_message - type: String - required: false -- name: last_synchronization_error_date - type: Integer - required: false -- name: max_connections - type: Integer - required: false -- name: allowed_updates - type: Array of String - required: false -ChatBoostRemoved: -- name: chat - type: Chat - required: true -- name: boost_id - type: String - required: true -- name: remove_date - type: Integer - required: true -- name: source - type: ChatBoostSource - required: true -ChatBoostSourceGiveaway: -- name: source - type: String - required: true - required_value: giveaway -- name: giveaway_message_id - type: Integer - required: true -- name: user - type: User - required: false -- name: is_unclaimed - type: 'True' - required: false -ChatBoostSourceGiftCode: -- name: source - type: String - required: true - required_value: gift_code -- name: user - type: User - required: true -ChatBoostSourcePremium: -- name: source - type: String - required: true - required_value: premium -- name: user - type: User - required: true -ChatBoost: -- name: boost_id - type: String - required: true -- name: add_date - type: Integer - required: true -- name: expiration_date - type: Integer - required: true -- name: source - type: ChatBoostSource - required: true -ChatBoostUpdated: -- name: chat - type: Chat - required: true -- name: boost - type: ChatBoost - required: true -ChatJoinRequest: -- name: chat - type: Chat - required: true -- name: from - type: User - required: true -- name: user_chat_id - type: Integer - required: true -- name: date - type: Integer - required: true -- name: bio - type: String - required: false -- name: invite_link - type: ChatInviteLink - required: false -ChatInviteLink: -- name: invite_link - type: String - required: true -- name: creator - type: User - required: true -- name: creates_join_request - type: Boolean - required: true -- name: is_primary - type: Boolean - required: true -- name: is_revoked - type: Boolean - required: true -- name: name - type: String - required: false -- name: expire_date - type: Integer - required: false -- name: member_limit - type: Integer - required: false -- name: pending_join_request_count - type: Integer - required: false -ChatMemberRestricted: -- name: status - type: String - required: true - required_value: restricted -- name: user - type: User - required: true -- name: is_member - type: Boolean - required: true -- name: can_send_messages - type: Boolean - required: true -- name: can_send_audios - type: Boolean - required: true -- name: can_send_documents - type: Boolean - required: true -- name: can_send_photos - type: Boolean - required: true -- name: can_send_videos - type: Boolean - required: true -- name: can_send_video_notes - type: Boolean - required: true -- name: can_send_voice_notes - type: Boolean - required: true -- name: can_send_polls - type: Boolean - required: true -- name: can_send_other_messages - type: Boolean - required: true -- name: can_add_web_page_previews - type: Boolean - required: true -- name: can_change_info - type: Boolean - required: true -- name: can_invite_users - type: Boolean - required: true -- name: can_pin_messages - type: Boolean - required: true -- name: can_manage_topics - type: Boolean - required: true -- name: until_date - type: Integer - required: true -ChatMemberOwner: -- name: status - type: String - required: true - required_value: creator -- name: user - type: User - required: true -- name: is_anonymous - type: Boolean - required: true -- name: custom_title - type: String - required: false -ChatMemberMember: -- name: status - type: String - required: true - required_value: member -- name: user - type: User - required: true -ChatMemberLeft: -- name: status - type: String - required: true - required_value: left -- name: user - type: User - required: true -ChatMemberBanned: -- name: status - type: String - required: true - required_value: kicked -- name: user - type: User - required: true -- name: until_date - type: Integer - required: true -ChatMemberAdministrator: -- name: status - type: String - required: true - required_value: administrator -- name: user - type: User - required: true -- name: can_be_edited - type: Boolean - required: true -- name: is_anonymous - type: Boolean - required: true -- name: can_manage_chat - type: Boolean - required: true -- name: can_delete_messages - type: Boolean - required: true -- name: can_manage_video_chats - type: Boolean - required: true -- name: can_restrict_members - type: Boolean - required: true -- name: can_promote_members - type: Boolean - required: true -- name: can_change_info - type: Boolean - required: true -- name: can_invite_users - type: Boolean - required: true -- name: can_post_messages - type: Boolean - required: false -- name: can_edit_messages - type: Boolean - required: false -- name: can_pin_messages - type: Boolean - required: false -- name: can_post_stories - type: Boolean - required: false -- name: can_edit_stories - type: Boolean - required: false -- name: can_delete_stories - type: Boolean - required: false -- name: can_manage_topics - type: Boolean - required: false -- name: custom_title - type: String - required: false -ChatMemberUpdated: -- name: chat - type: Chat - required: true -- name: from - type: User - required: true -- name: date - type: Integer - required: true -- name: old_chat_member - type: ChatMember - required: true -- name: new_chat_member - type: ChatMember - required: true -- name: invite_link - type: ChatInviteLink - required: false -- name: via_chat_folder_invite_link - type: Boolean - required: false -PollAnswer: -- name: poll_id - type: String - required: true -- name: voter_chat - type: Chat - required: false -- name: user - type: User - required: false -- name: option_ids - type: Array of Integer - required: true -PreCheckoutQuery: -- name: id - type: String - required: true -- name: from - type: User - required: true -- name: currency - type: String - required: true -- name: total_amount - type: Integer - required: true -- name: invoice_payload - type: String - required: true -- name: shipping_option_id - type: String - required: false -- name: order_info - type: OrderInfo - required: false -ShippingQuery: -- name: id - type: String - required: true -- name: from - type: User - required: true -- name: invoice_payload - type: String - required: true -- name: shipping_address - type: ShippingAddress - required: true -CallbackQuery: -- name: id - type: String - required: true -- name: from - type: User - required: true -- name: message - type: MaybeInaccessibleMessage - required: false -- name: inline_message_id - type: String - required: false -- name: chat_instance - type: String - required: true -- name: data - type: String - required: false -- name: game_short_name - type: String - required: false -ChosenInlineResult: -- name: result_id - type: String - required: true -- name: from - type: User - required: true -- name: location - type: Location - required: false -- name: inline_message_id - type: String - required: false -- name: query - type: String - required: true -InlineQuery: -- name: id - type: String - required: true -- name: from - type: User - required: true -- name: query - type: String - required: true -- name: offset - type: String - required: true -- name: chat_type - type: String - required: false -- name: location - type: Location - required: false -ReactionCount: -- name: type - type: ReactionType - required: true -- name: total_count - type: Integer - required: true -MessageReactionCountUpdated: -- name: chat - type: Chat - required: true -- name: message_id - type: Integer - required: true -- name: date - type: Integer - required: true -- name: reactions - type: Array of ReactionCount - required: true -MessageReactionUpdated: -- name: chat - type: Chat - required: true -- name: message_id - type: Integer - required: true -- name: user - type: User - required: false -- name: actor_chat - type: Chat - required: false -- name: date - type: Integer - required: true -- name: old_reaction - type: Array of ReactionType - required: true -- name: new_reaction - type: Array of ReactionType - required: true -CallbackGame: [] -SwitchInlineQueryChosenChat: -- name: query - type: String - required: false -- name: allow_user_chats - type: Boolean - required: false -- name: allow_bot_chats - type: Boolean - required: false -- name: allow_group_chats - type: Boolean - required: false -- name: allow_channel_chats - type: Boolean - required: false -LoginUrl: -- name: url - type: String - required: true -- name: forward_text - type: String - required: false -- name: bot_username - type: String - required: false -- name: request_write_access - type: Boolean - required: false -WebAppInfo: -- name: url - type: String - required: true -InlineKeyboardButton: -- name: text - type: String - required: true -- name: url - type: String - required: false -- name: callback_data - type: String - required: false -- name: web_app - type: WebAppInfo - required: false -- name: login_url - type: LoginUrl - required: false -- name: switch_inline_query - type: String - required: false -- name: switch_inline_query_current_chat - type: String - required: false -- name: switch_inline_query_chosen_chat - type: SwitchInlineQueryChosenChat - required: false -- name: callback_game - type: CallbackGame - required: false -- name: pay - type: Boolean - required: false -InlineKeyboardMarkup: -- name: inline_keyboard - type: Array of Array of InlineKeyboardButton - required: true -WebAppData: -- name: data - type: String - required: true -- name: button_text - type: String - required: true -VideoChatParticipantsInvited: -- name: users - type: Array of User - required: true -VideoChatEnded: -- name: duration - type: Integer - required: true -VideoChatStarted: [] -VideoChatScheduled: -- name: start_date - type: Integer - required: true -GiveawayCompleted: -- name: winner_count - type: Integer - required: true -- name: unclaimed_prize_count - type: Integer - required: false -- name: giveaway_message - type: Message - required: false -GiveawayCreated: [] -GeneralForumTopicUnhidden: [] -GeneralForumTopicHidden: [] -ForumTopicReopened: [] -ForumTopicClosed: [] -ForumTopicEdited: -- name: name - type: String - required: false -- name: icon_custom_emoji_id - type: String - required: false -ForumTopicCreated: -- name: name - type: String - required: true -- name: icon_color - type: Integer - required: true -- name: icon_custom_emoji_id - type: String - required: false -ProximityAlertTriggered: -- name: traveler - type: User - required: true -- name: watcher - type: User - required: true -- name: distance - type: Integer - required: true -EncryptedCredentials: -- name: data - type: String - required: true -- name: hash - type: String - required: true -- name: secret - type: String - required: true -PassportFile: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: file_size - type: Integer - required: true -- name: file_date - type: Integer - required: true -EncryptedPassportElement: -- name: type - type: String - required: true -- name: data - type: String - required: false -- name: phone_number - type: String - required: false -- name: email - type: String - required: false -- name: files - type: Array of PassportFile - required: false -- name: front_side - type: PassportFile - required: false -- name: reverse_side - type: PassportFile - required: false -- name: selfie - type: PassportFile - required: false -- name: translation - type: Array of PassportFile - required: false -- name: hash - type: String - required: true -PassportData: -- name: data - type: Array of EncryptedPassportElement - required: true -- name: credentials - type: EncryptedCredentials - required: true -WriteAccessAllowed: -- name: from_request - type: Boolean - required: false -- name: web_app_name - type: String - required: false -- name: from_attachment_menu - type: Boolean - required: false -ChatShared: -- name: request_id - type: Integer - required: true -- name: chat_id - type: Integer - required: true -UsersShared: -- name: request_id - type: Integer - required: true -- name: user_ids - type: Array of Integer - required: true -ShippingAddress: -- name: country_code - type: String - required: true -- name: state - type: String - required: true -- name: city - type: String - required: true -- name: street_line1 - type: String - required: true -- name: street_line2 - type: String - required: true -- name: post_code - type: String - required: true -OrderInfo: -- name: name - type: String - required: false -- name: phone_number - type: String - required: false -- name: email - type: String - required: false -- name: shipping_address - type: ShippingAddress - required: false -SuccessfulPayment: -- name: currency - type: String - required: true -- name: total_amount - type: Integer - required: true -- name: invoice_payload - type: String - required: true -- name: shipping_option_id - type: String - required: false -- name: order_info - type: OrderInfo - required: false -- name: telegram_payment_charge_id - type: String - required: true -- name: provider_payment_charge_id - type: String - required: true -InaccessibleMessage: -- name: chat - type: Chat - required: true -- name: message_id - type: Integer - required: true -- name: date - type: Integer - required: true -MessageAutoDeleteTimerChanged: -- name: message_auto_delete_time - type: Integer - required: true -TextQuote: -- name: text - type: String - required: true -- name: entities - type: Array of MessageEntity - required: false -- name: position - type: Integer - required: true -- name: is_manual - type: 'True' - required: false -Venue: -- name: location - type: Location - required: true -- name: title - type: String - required: true -- name: address - type: String - required: true -- name: foursquare_id - type: String - required: false -- name: foursquare_type - type: String - required: false -- name: google_place_id - type: String - required: false -- name: google_place_type - type: String - required: false -PollOption: -- name: text - type: String - required: true -- name: voter_count - type: Integer - required: true -Poll: -- name: id - type: String - required: true -- name: question - type: String - required: true -- name: options - type: Array of PollOption - required: true -- name: total_voter_count - type: Integer - required: true -- name: is_closed - type: Boolean - required: true -- name: is_anonymous - type: Boolean - required: true -- name: type - type: String - required: true -- name: allows_multiple_answers - type: Boolean - required: true -- name: correct_option_id - type: Integer - required: false -- name: explanation - type: String - required: false -- name: explanation_entities - type: Array of MessageEntity - required: false -- name: open_period - type: Integer - required: false -- name: close_date - type: Integer - required: false -Invoice: -- name: title - type: String - required: true -- name: description - type: String - required: true -- name: start_parameter - type: String - required: true -- name: currency - type: String - required: true -- name: total_amount - type: Integer - required: true -GiveawayWinners: -- name: chat - type: Chat - required: true -- name: giveaway_message_id - type: Integer - required: true -- name: winners_selection_date - type: Integer - required: true -- name: winner_count - type: Integer - required: true -- name: winners - type: Array of User - required: true -- name: additional_chat_count - type: Integer - required: false -- name: premium_subscription_month_count - type: Integer - required: false -- name: unclaimed_prize_count - type: Integer - required: false -- name: only_new_members - type: 'True' - required: false -- name: was_refunded - type: 'True' - required: false -- name: prize_description - type: String - required: false -Giveaway: -- name: chats - type: Array of Chat - required: true -- name: winners_selection_date - type: Integer - required: true -- name: winner_count - type: Integer - required: true -- name: only_new_members - type: 'True' - required: false -- name: has_public_winners - type: 'True' - required: false -- name: prize_description - type: String - required: false -- name: country_codes - type: Array of String - required: false -- name: premium_subscription_month_count - type: Integer - required: false -MessageEntity: -- name: type - type: String - required: true -- name: offset - type: Integer - required: true -- name: length - type: Integer - required: true -- name: url - type: String - required: false -- name: user - type: User - required: false -- name: language - type: String - required: false -- name: custom_emoji_id - type: String - required: false -Game: -- name: title - type: String - required: true -- name: description - type: String - required: true -- name: photo - type: Array of PhotoSize - required: true -- name: text - type: String - required: false -- name: text_entities - type: Array of MessageEntity - required: false -- name: animation - type: Animation - required: false -Dice: -- name: emoji - type: String - required: true -- name: value - type: Integer - required: true -Contact: -- name: phone_number - type: String - required: true -- name: first_name - type: String - required: true -- name: last_name - type: String - required: false -- name: user_id - type: Integer - required: false -- name: vcard - type: String - required: false -Voice: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: duration - type: Integer - required: true -- name: mime_type - type: String - required: false -- name: file_size - type: Integer - required: false -VideoNote: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: length - type: Integer - required: true -- name: duration - type: Integer - required: true -- name: thumbnail - type: PhotoSize - required: false -- name: file_size - type: Integer - required: false -Video: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: width - type: Integer - required: true -- name: height - type: Integer - required: true -- name: duration - type: Integer - required: true -- name: thumbnail - type: PhotoSize - required: false -- name: file_name - type: String - required: false -- name: mime_type - type: String - required: false -- name: file_size - type: Integer - required: false -Story: [] -MaskPosition: -- name: point - type: String - required: true -- name: x_shift - type: Float number - required: true -- name: y_shift - type: Float number - required: true -- name: scale - type: Float number - required: true -File: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: file_size - type: Integer - required: false -- name: file_path - type: String - required: false -Sticker: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: type - type: String - required: true -- name: width - type: Integer - required: true -- name: height - type: Integer - required: true -- name: is_animated - type: Boolean - required: true -- name: is_video - type: Boolean - required: true -- name: thumbnail - type: PhotoSize - required: false -- name: emoji - type: String - required: false -- name: set_name - type: String - required: false -- name: premium_animation - type: File - required: false -- name: mask_position - type: MaskPosition - required: false -- name: custom_emoji_id - type: String - required: false -- name: needs_repainting - type: 'True' - required: false -- name: file_size - type: Integer - required: false -Document: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: thumbnail - type: PhotoSize - required: false -- name: file_name - type: String - required: false -- name: mime_type - type: String - required: false -- name: file_size - type: Integer - required: false -Audio: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: duration - type: Integer - required: true -- name: performer - type: String - required: false -- name: title - type: String - required: false -- name: file_name - type: String - required: false -- name: mime_type - type: String - required: false -- name: file_size - type: Integer - required: false -- name: thumbnail - type: PhotoSize - required: false -PhotoSize: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: width - type: Integer - required: true -- name: height - type: Integer - required: true -- name: file_size - type: Integer - required: false -Animation: -- name: file_id - type: String - required: true -- name: file_unique_id - type: String - required: true -- name: width - type: Integer - required: true -- name: height - type: Integer - required: true -- name: duration - type: Integer - required: true -- name: thumbnail - type: PhotoSize - required: false -- name: file_name - type: String - required: false -- name: mime_type - type: String - required: false -- name: file_size - type: Integer - required: false -LinkPreviewOptions: -- name: is_disabled - type: Boolean - required: false -- name: url - type: String - required: false -- name: prefer_small_media - type: Boolean - required: false -- name: prefer_large_media - type: Boolean - required: false -- name: show_above_text - type: Boolean - required: false -ExternalReplyInfo: -- name: origin - type: MessageOrigin - required: true -- name: chat - type: Chat - required: false -- name: message_id - type: Integer - required: false -- name: link_preview_options - type: LinkPreviewOptions - required: false -- name: animation - type: Animation - required: false -- name: audio - type: Audio - required: false -- name: document - type: Document - required: false -- name: photo - type: Array of PhotoSize - required: false -- name: sticker - type: Sticker - required: false -- name: story - type: Story - required: false -- name: video - type: Video - required: false -- name: video_note - type: VideoNote - required: false -- name: voice - type: Voice - required: false -- name: has_media_spoiler - type: 'True' - required: false -- name: contact - type: Contact - required: false -- name: dice - type: Dice - required: false -- name: game - type: Game - required: false -- name: giveaway - type: Giveaway - required: false -- name: giveaway_winners - type: GiveawayWinners - required: false -- name: invoice - type: Invoice - required: false -- name: location - type: Location - required: false -- name: poll - type: Poll - required: false -- name: venue - type: Venue - required: false -MessageOriginChannel: -- name: type - type: String - required: true - required_value: channel -- name: date - type: Integer - required: true -- name: chat - type: Chat - required: true -- name: message_id - type: Integer - required: true -- name: author_signature - type: String - required: false -MessageOriginChat: -- name: type - type: String - required: true - required_value: chat -- name: date - type: Integer - required: true -- name: sender_chat - type: Chat - required: true -- name: author_signature - type: String - required: false -MessageOriginHiddenUser: -- name: type - type: String - required: true - required_value: hidden_user -- name: date - type: Integer - required: true -- name: sender_user_name - type: String - required: true -MessageOriginUser: -- name: type - type: String - required: true - required_value: user -- name: date - type: Integer - required: true -- name: sender_user - type: User - required: true -Location: -- name: longitude - type: Float - required: true -- name: latitude - type: Float - required: true -- name: horizontal_accuracy - type: Float number - required: false -- name: live_period - type: Integer - required: false -- name: heading - type: Integer - required: false -- name: proximity_alert_radius - type: Integer - required: false -ChatLocation: -- name: location - type: Location - required: true -- name: address - type: String - required: true -ChatPermissions: -- name: can_send_messages - type: Boolean - required: false -- name: can_send_audios - type: Boolean - required: false -- name: can_send_documents - type: Boolean - required: false -- name: can_send_photos - type: Boolean - required: false -- name: can_send_videos - type: Boolean - required: false -- name: can_send_video_notes - type: Boolean - required: false -- name: can_send_voice_notes - type: Boolean - required: false -- name: can_send_polls - type: Boolean - required: false -- name: can_send_other_messages - type: Boolean - required: false -- name: can_add_web_page_previews - type: Boolean - required: false -- name: can_change_info - type: Boolean - required: false -- name: can_invite_users - type: Boolean - required: false -- name: can_pin_messages - type: Boolean - required: false -- name: can_manage_topics - type: Boolean - required: false -ReactionTypeCustomEmoji: -- name: type - type: String - required: true - required_value: custom_emoji -- name: custom_emoji_id - type: String - required: true -ReactionTypeEmoji: -- name: type - type: String - required: true - required_value: emoji -- name: emoji - type: String - required: true -ChatPhoto: -- name: small_file_id - type: String - required: true -- name: small_file_unique_id - type: String - required: true -- name: big_file_id - type: String - required: true -- name: big_file_unique_id - type: String - required: true -Chat: -- name: id - type: Integer - required: true -- name: type - type: String - required: true -- name: title - type: String - required: false -- name: username - type: String - required: false -- name: first_name - type: String - required: false -- name: last_name - type: String - required: false -- name: is_forum - type: 'True' - required: false -- name: photo - type: ChatPhoto - required: false -- name: active_usernames - type: Array of String - required: false -- name: available_reactions - type: Array of ReactionType - required: false -- name: accent_color_id - type: Integer - required: false -- name: background_custom_emoji_id - type: String - required: false -- name: profile_accent_color_id - type: Integer - required: false -- name: profile_background_custom_emoji_id - type: String - required: false -- name: emoji_status_custom_emoji_id - type: String - required: false -- name: emoji_status_expiration_date - type: Integer - required: false -- name: bio - type: String - required: false -- name: has_private_forwards - type: 'True' - required: false -- name: has_restricted_voice_and_video_messages - type: 'True' - required: false -- name: join_to_send_messages - type: 'True' - required: false -- name: join_by_request - type: 'True' - required: false -- name: description - type: String - required: false -- name: invite_link - type: String - required: false -- name: pinned_message - type: Message - required: false -- name: permissions - type: ChatPermissions - required: false -- name: slow_mode_delay - type: Integer - required: false -- name: message_auto_delete_time - type: Integer - required: false -- name: has_aggressive_anti_spam_enabled - type: 'True' - required: false -- name: has_hidden_members - type: 'True' - required: false -- name: has_protected_content - type: 'True' - required: false -- name: has_visible_history - type: 'True' - required: false -- name: sticker_set_name - type: String - required: false -- name: can_set_sticker_set - type: 'True' - required: false -- name: linked_chat_id - type: Integer - required: false -- name: location - type: ChatLocation - required: false -User: -- name: id - type: Integer - required: true -- name: is_bot - type: Boolean - required: true -- name: first_name - type: String - required: true -- name: last_name - type: String - required: false -- name: username - type: String - required: false -- name: language_code - type: String - required: false -- name: is_premium - type: 'True' - required: false -- name: added_to_attachment_menu - type: 'True' - required: false -- name: can_join_groups - type: Boolean - required: false -- name: can_read_all_group_messages - type: Boolean - required: false -- name: supports_inline_queries - type: Boolean - required: false -Message: -- name: message_id - type: Integer - required: true -- name: message_thread_id - type: Integer - required: false -- name: from - type: User - required: false -- name: sender_chat - type: Chat - required: false -- name: date - type: Integer - required: true -- name: chat - type: Chat - required: true -- name: forward_origin - type: MessageOrigin - required: false -- name: is_topic_message - type: 'True' - required: false -- name: is_automatic_forward - type: 'True' - required: false -- name: reply_to_message - type: Message - required: false -- name: external_reply - type: ExternalReplyInfo - required: false -- name: quote - type: TextQuote - required: false -- name: via_bot - type: User - required: false -- name: edit_date - type: Integer - required: false -- name: has_protected_content - type: 'True' - required: false -- name: media_group_id - type: String - required: false -- name: author_signature - type: String - required: false -- name: text - type: String - required: false -- name: entities - type: Array of MessageEntity - required: false -- name: link_preview_options - type: LinkPreviewOptions - required: false -- name: animation - type: Animation - required: false -- name: audio - type: Audio - required: false -- name: document - type: Document - required: false -- name: photo - type: Array of PhotoSize - required: false -- name: sticker - type: Sticker - required: false -- name: story - type: Story - required: false -- name: video - type: Video - required: false -- name: video_note - type: VideoNote - required: false -- name: voice - type: Voice - required: false -- name: caption - type: String - required: false -- name: caption_entities - type: Array of MessageEntity - required: false -- name: has_media_spoiler - type: 'True' - required: false -- name: contact - type: Contact - required: false -- name: dice - type: Dice - required: false -- name: game - type: Game - required: false -- name: poll - type: Poll - required: false -- name: venue - type: Venue - required: false -- name: location - type: Location - required: false -- name: new_chat_members - type: Array of User - required: false -- name: left_chat_member - type: User - required: false -- name: new_chat_title - type: String - required: false -- name: new_chat_photo - type: Array of PhotoSize - required: false -- name: delete_chat_photo - type: 'True' - required: false -- name: group_chat_created - type: 'True' - required: false -- name: supergroup_chat_created - type: 'True' - required: false -- name: channel_chat_created - type: 'True' - required: false -- name: message_auto_delete_timer_changed - type: MessageAutoDeleteTimerChanged - required: false -- name: migrate_to_chat_id - type: Integer - required: false -- name: migrate_from_chat_id - type: Integer - required: false -- name: pinned_message - type: MaybeInaccessibleMessage - required: false -- name: invoice - type: Invoice - required: false -- name: successful_payment - type: SuccessfulPayment - required: false -- name: users_shared - type: UsersShared - required: false -- name: chat_shared - type: ChatShared - required: false -- name: connected_website - type: String - required: false -- name: write_access_allowed - type: WriteAccessAllowed - required: false -- name: passport_data - type: PassportData - required: false -- name: proximity_alert_triggered - type: ProximityAlertTriggered - required: false -- name: forum_topic_created - type: ForumTopicCreated - required: false -- name: forum_topic_edited - type: ForumTopicEdited - required: false -- name: forum_topic_closed - type: ForumTopicClosed - required: false -- name: forum_topic_reopened - type: ForumTopicReopened - required: false -- name: general_forum_topic_hidden - type: GeneralForumTopicHidden - required: false -- name: general_forum_topic_unhidden - type: GeneralForumTopicUnhidden - required: false -- name: giveaway_created - type: GiveawayCreated - required: false -- name: giveaway - type: Giveaway - required: false -- name: giveaway_winners - type: GiveawayWinners - required: false -- name: giveaway_completed - type: GiveawayCompleted - required: false -- name: video_chat_scheduled - type: VideoChatScheduled - required: false -- name: video_chat_started - type: VideoChatStarted - required: false -- name: video_chat_ended - type: VideoChatEnded - required: false -- name: video_chat_participants_invited - type: VideoChatParticipantsInvited - required: false -- name: web_app_data - type: WebAppData - required: false -- name: reply_markup - type: InlineKeyboardMarkup - required: false -Update: -- name: update_id - type: Integer - required: true -- name: message - type: Message - required: false -- name: edited_message - type: Message - required: false -- name: channel_post - type: Message - required: false -- name: edited_channel_post - type: Message - required: false -- name: message_reaction - type: MessageReactionUpdated - required: false -- name: message_reaction_count - type: MessageReactionCountUpdated - required: false -- name: inline_query - type: InlineQuery - required: false -- name: chosen_inline_result - type: ChosenInlineResult - required: false -- name: callback_query - type: CallbackQuery - required: false -- name: shipping_query - type: ShippingQuery - required: false -- name: pre_checkout_query - type: PreCheckoutQuery - required: false -- name: poll - type: Poll - required: false -- name: poll_answer - type: PollAnswer - required: false -- name: my_chat_member - type: ChatMemberUpdated - required: false -- name: chat_member - type: ChatMemberUpdated - required: false -- name: chat_join_request - type: ChatJoinRequest - required: false -- name: chat_boost - type: ChatBoostUpdated - required: false -- name: removed_chat_boost - type: ChatBoostRemoved - required: false diff --git a/utility/empty_type.erb b/utility/empty_type.erb new file mode 100644 index 00000000..1d1e1e57 --- /dev/null +++ b/utility/empty_type.erb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + ## Just for classes consistency + # rubocop:disable Naming/ConstantName + <%= name %> = ( + <%= attributes %> + ) + # rubocop:enable Naming/ConstantName + end + end +end diff --git a/utility/type.erb b/utility/type.erb new file mode 100644 index 00000000..35a49290 --- /dev/null +++ b/utility/type.erb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class <%= name %> < Base + <% attributes.each_pair do |name, properties| %> + <%= "#{properties[:required] ? 'attribute' : 'attribute?'} :#{name}, #{properties[:type]}" %> + <% end %> + end + end + end +end diff --git a/utility/type_attributes.json b/utility/type_attributes.json new file mode 100644 index 00000000..cac541f0 --- /dev/null +++ b/utility/type_attributes.json @@ -0,0 +1,5138 @@ +{ + "Error": { + "ok": { + "type": "boolean", + "required": true + }, + "error_code": { + "type": "integer", + "required": true + }, + "description": { + "type": "string", + "required": true + }, + "parameters": { + "type": "ResponseParameters" + } + }, + "Update": { + "update_id": { + "type": "integer", + "required": true + }, + "message": { + "type": "Message" + }, + "edited_message": { + "type": "Message" + }, + "channel_post": { + "type": "Message" + }, + "edited_channel_post": { + "type": "Message" + }, + "business_connection": { + "type": "BusinessConnection" + }, + "business_message": { + "type": "Message" + }, + "edited_business_message": { + "type": "Message" + }, + "deleted_business_messages": { + "type": "BusinessMessagesDeleted" + }, + "message_reaction": { + "type": "MessageReactionUpdated" + }, + "message_reaction_count": { + "type": "MessageReactionCountUpdated" + }, + "inline_query": { + "type": "InlineQuery" + }, + "chosen_inline_result": { + "type": "ChosenInlineResult" + }, + "callback_query": { + "type": "CallbackQuery" + }, + "shipping_query": { + "type": "ShippingQuery" + }, + "pre_checkout_query": { + "type": "PreCheckoutQuery" + }, + "purchased_paid_media": { + "type": "PaidMediaPurchased" + }, + "poll": { + "type": "Poll" + }, + "poll_answer": { + "type": "PollAnswer" + }, + "my_chat_member": { + "type": "ChatMemberUpdated" + }, + "chat_member": { + "type": "ChatMemberUpdated" + }, + "chat_join_request": { + "type": "ChatJoinRequest" + }, + "chat_boost": { + "type": "ChatBoostUpdated" + }, + "removed_chat_boost": { + "type": "ChatBoostRemoved" + } + }, + "WebhookInfo": { + "url": { + "type": "string", + "required": true + }, + "has_custom_certificate": { + "type": "boolean", + "required": true + }, + "pending_update_count": { + "type": "integer", + "required": true + }, + "ip_address": { + "type": "string" + }, + "last_error_date": { + "type": "integer" + }, + "last_error_message": { + "type": "string" + }, + "last_synchronization_error_date": { + "type": "integer" + }, + "max_connections": { + "type": "integer" + }, + "allowed_updates": { + "type": "array", + "items": "string" + } + }, + "User": { + "id": { + "type": "integer", + "required": true + }, + "is_bot": { + "type": "boolean", + "required": true + }, + "first_name": { + "type": "string", + "required": true + }, + "last_name": { + "type": "string" + }, + "username": { + "type": "string" + }, + "language_code": { + "type": "string" + }, + "is_premium": { + "type": "boolean", + "default": true + }, + "added_to_attachment_menu": { + "type": "boolean", + "default": true + }, + "can_join_groups": { + "type": "boolean" + }, + "can_read_all_group_messages": { + "type": "boolean" + }, + "supports_inline_queries": { + "type": "boolean" + }, + "can_connect_to_business": { + "type": "boolean" + }, + "has_main_web_app": { + "type": "boolean" + } + }, + "Chat": { + "id": { + "type": "integer", + "required": true + }, + "type": { + "type": "string", + "required": true + }, + "title": { + "type": "string" + }, + "username": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "is_forum": { + "type": "boolean", + "default": true + } + }, + "ChatFullInfo": { + "id": { + "type": "integer", + "required": true + }, + "type": { + "type": "string", + "required": true + }, + "title": { + "type": "string" + }, + "username": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "is_forum": { + "type": "boolean", + "default": true + }, + "accent_color_id": { + "type": "integer", + "required": true + }, + "max_reaction_count": { + "type": "integer", + "required": true + }, + "photo": { + "type": "ChatPhoto" + }, + "active_usernames": { + "type": "array", + "items": "string" + }, + "birthdate": { + "type": "Birthdate" + }, + "business_intro": { + "type": "BusinessIntro" + }, + "business_location": { + "type": "BusinessLocation" + }, + "business_opening_hours": { + "type": "BusinessOpeningHours" + }, + "personal_chat": { + "type": "Chat" + }, + "available_reactions": { + "type": "array", + "items": "ReactionType" + }, + "background_custom_emoji_id": { + "type": "string" + }, + "profile_accent_color_id": { + "type": "integer" + }, + "profile_background_custom_emoji_id": { + "type": "string" + }, + "emoji_status_custom_emoji_id": { + "type": "string" + }, + "emoji_status_expiration_date": { + "type": "integer" + }, + "bio": { + "type": "string" + }, + "has_private_forwards": { + "type": "boolean", + "default": true + }, + "has_restricted_voice_and_video_messages": { + "type": "boolean", + "default": true + }, + "join_to_send_messages": { + "type": "boolean", + "default": true + }, + "join_by_request": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + }, + "invite_link": { + "type": "string" + }, + "pinned_message": { + "type": "Message" + }, + "permissions": { + "type": "ChatPermissions" + }, + "can_send_paid_media": { + "type": "boolean", + "default": true + }, + "slow_mode_delay": { + "type": "integer" + }, + "unrestrict_boost_count": { + "type": "integer" + }, + "message_auto_delete_time": { + "type": "integer" + }, + "has_aggressive_anti_spam_enabled": { + "type": "boolean", + "default": true + }, + "has_hidden_members": { + "type": "boolean", + "default": true + }, + "has_protected_content": { + "type": "boolean", + "default": true + }, + "has_visible_history": { + "type": "boolean", + "default": true + }, + "sticker_set_name": { + "type": "string" + }, + "can_set_sticker_set": { + "type": "boolean", + "default": true + }, + "custom_emoji_sticker_set_name": { + "type": "string" + }, + "linked_chat_id": { + "type": "integer" + }, + "location": { + "type": "ChatLocation" + } + }, + "Message": { + "message_id": { + "type": "integer", + "required": true + }, + "message_thread_id": { + "type": "integer" + }, + "from": { + "type": "User" + }, + "sender_chat": { + "type": "Chat" + }, + "sender_boost_count": { + "type": "integer" + }, + "sender_business_bot": { + "type": "User" + }, + "date": { + "type": "integer", + "required": true + }, + "business_connection_id": { + "type": "string" + }, + "chat": { + "type": "Chat", + "required": true + }, + "forward_origin": { + "type": "MessageOrigin" + }, + "is_topic_message": { + "type": "boolean", + "default": true + }, + "is_automatic_forward": { + "type": "boolean", + "default": true + }, + "reply_to_message": { + "type": "Message" + }, + "external_reply": { + "type": "ExternalReplyInfo" + }, + "quote": { + "type": "TextQuote" + }, + "reply_to_story": { + "type": "Story" + }, + "via_bot": { + "type": "User" + }, + "edit_date": { + "type": "integer" + }, + "has_protected_content": { + "type": "boolean", + "default": true + }, + "is_from_offline": { + "type": "boolean", + "default": true + }, + "media_group_id": { + "type": "string" + }, + "author_signature": { + "type": "string" + }, + "text": { + "type": "string" + }, + "entities": { + "type": "array", + "items": "MessageEntity" + }, + "link_preview_options": { + "type": "LinkPreviewOptions" + }, + "effect_id": { + "type": "string" + }, + "animation": { + "type": "Animation" + }, + "audio": { + "type": "Audio" + }, + "document": { + "type": "Document" + }, + "paid_media": { + "type": "PaidMediaInfo" + }, + "photo": { + "type": "array", + "items": "PhotoSize" + }, + "sticker": { + "type": "Sticker" + }, + "story": { + "type": "Story" + }, + "video": { + "type": "Video" + }, + "video_note": { + "type": "VideoNote" + }, + "voice": { + "type": "Voice" + }, + "caption": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean", + "default": true + }, + "has_media_spoiler": { + "type": "boolean", + "default": true + }, + "contact": { + "type": "Contact" + }, + "dice": { + "type": "Dice" + }, + "game": { + "type": "Game" + }, + "poll": { + "type": "Poll" + }, + "venue": { + "type": "Venue" + }, + "location": { + "type": "Location" + }, + "new_chat_members": { + "type": "array", + "items": "User" + }, + "left_chat_member": { + "type": "User" + }, + "new_chat_title": { + "type": "string" + }, + "new_chat_photo": { + "type": "array", + "items": "PhotoSize" + }, + "delete_chat_photo": { + "type": "boolean", + "default": true + }, + "group_chat_created": { + "type": "boolean", + "default": true + }, + "supergroup_chat_created": { + "type": "boolean", + "default": true + }, + "channel_chat_created": { + "type": "boolean", + "default": true + }, + "message_auto_delete_timer_changed": { + "type": "MessageAutoDeleteTimerChanged" + }, + "migrate_to_chat_id": { + "type": "integer" + }, + "migrate_from_chat_id": { + "type": "integer" + }, + "pinned_message": { + "type": "MaybeInaccessibleMessage" + }, + "invoice": { + "type": "Invoice" + }, + "successful_payment": { + "type": "SuccessfulPayment" + }, + "refunded_payment": { + "type": "RefundedPayment" + }, + "users_shared": { + "type": "UsersShared" + }, + "chat_shared": { + "type": "ChatShared" + }, + "connected_website": { + "type": "string" + }, + "write_access_allowed": { + "type": "WriteAccessAllowed" + }, + "passport_data": { + "type": "PassportData" + }, + "proximity_alert_triggered": { + "type": "ProximityAlertTriggered" + }, + "boost_added": { + "type": "ChatBoostAdded" + }, + "chat_background_set": { + "type": "ChatBackground" + }, + "forum_topic_created": { + "type": "ForumTopicCreated" + }, + "forum_topic_edited": { + "type": "ForumTopicEdited" + }, + "forum_topic_closed": { + "type": "ForumTopicClosed" + }, + "forum_topic_reopened": { + "type": "ForumTopicReopened" + }, + "general_forum_topic_hidden": { + "type": "GeneralForumTopicHidden" + }, + "general_forum_topic_unhidden": { + "type": "GeneralForumTopicUnhidden" + }, + "giveaway_created": { + "type": "GiveawayCreated" + }, + "giveaway": { + "type": "Giveaway" + }, + "giveaway_winners": { + "type": "GiveawayWinners" + }, + "giveaway_completed": { + "type": "GiveawayCompleted" + }, + "video_chat_scheduled": { + "type": "VideoChatScheduled" + }, + "video_chat_started": { + "type": "VideoChatStarted" + }, + "video_chat_ended": { + "type": "VideoChatEnded" + }, + "video_chat_participants_invited": { + "type": "VideoChatParticipantsInvited" + }, + "web_app_data": { + "type": "WebAppData" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + } + }, + "MessageId": { + "message_id": { + "type": "integer", + "required": true + } + }, + "InaccessibleMessage": { + "chat": { + "type": "Chat", + "required": true + }, + "message_id": { + "type": "integer", + "required": true + }, + "date": { + "type": "integer", + "required": true + } + }, + "MaybeInaccessibleMessage": { + "type": [ + "Message", + "InaccessibleMessage" + ] + }, + "MessageEntity": { + "type": { + "type": "string", + "required": true + }, + "offset": { + "type": "integer", + "required": true + }, + "length": { + "type": "integer", + "required": true + }, + "url": { + "type": "string" + }, + "user": { + "type": "User" + }, + "language": { + "type": "string" + }, + "custom_emoji_id": { + "type": "string" + } + }, + "TextQuote": { + "text": { + "type": "string", + "required": true + }, + "entities": { + "type": "array", + "items": "MessageEntity" + }, + "position": { + "type": "integer", + "required": true + }, + "is_manual": { + "type": "boolean", + "default": true + } + }, + "ExternalReplyInfo": { + "origin": { + "type": "MessageOrigin", + "required": true + }, + "chat": { + "type": "Chat" + }, + "message_id": { + "type": "integer" + }, + "link_preview_options": { + "type": "LinkPreviewOptions" + }, + "animation": { + "type": "Animation" + }, + "audio": { + "type": "Audio" + }, + "document": { + "type": "Document" + }, + "paid_media": { + "type": "PaidMediaInfo" + }, + "photo": { + "type": "array", + "items": "PhotoSize" + }, + "sticker": { + "type": "Sticker" + }, + "story": { + "type": "Story" + }, + "video": { + "type": "Video" + }, + "video_note": { + "type": "VideoNote" + }, + "voice": { + "type": "Voice" + }, + "has_media_spoiler": { + "type": "boolean", + "default": true + }, + "contact": { + "type": "Contact" + }, + "dice": { + "type": "Dice" + }, + "game": { + "type": "Game" + }, + "giveaway": { + "type": "Giveaway" + }, + "giveaway_winners": { + "type": "GiveawayWinners" + }, + "invoice": { + "type": "Invoice" + }, + "location": { + "type": "Location" + }, + "poll": { + "type": "Poll" + }, + "venue": { + "type": "Venue" + } + }, + "ReplyParameters": { + "message_id": { + "type": "integer", + "required": true + }, + "chat_id": { + "type": [ + "integer", + "string" + ] + }, + "allow_sending_without_reply": { + "type": "boolean" + }, + "quote": { + "type": "string", + "max_size": 1024 + }, + "quote_parse_mode": { + "type": "string" + }, + "quote_entities": { + "type": "array", + "items": "MessageEntity" + }, + "quote_position": { + "type": "integer" + } + }, + "MessageOrigin": { + "type": [ + "MessageOriginUser", + "MessageOriginHiddenUser", + "MessageOriginChat", + "MessageOriginChannel" + ] + }, + "MessageOriginUser": { + "type": { + "type": "string", + "required": true, + "required_value": "user", + "default": "user" + }, + "date": { + "type": "integer", + "required": true + }, + "sender_user": { + "type": "User", + "required": true + } + }, + "MessageOriginHiddenUser": { + "type": { + "type": "string", + "required": true, + "required_value": "hidden_user", + "default": "hidden_user" + }, + "date": { + "type": "integer", + "required": true + }, + "sender_user_name": { + "type": "string", + "required": true + } + }, + "MessageOriginChat": { + "type": { + "type": "string", + "required": true, + "required_value": "chat", + "default": "chat" + }, + "date": { + "type": "integer", + "required": true + }, + "sender_chat": { + "type": "Chat", + "required": true + }, + "author_signature": { + "type": "string" + } + }, + "MessageOriginChannel": { + "type": { + "type": "string", + "required": true, + "required_value": "channel", + "default": "channel" + }, + "date": { + "type": "integer", + "required": true + }, + "chat": { + "type": "Chat", + "required": true + }, + "message_id": { + "type": "integer", + "required": true + }, + "author_signature": { + "type": "string" + } + }, + "PhotoSize": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "width": { + "type": "integer", + "required": true + }, + "height": { + "type": "integer", + "required": true + }, + "file_size": { + "type": "integer" + } + }, + "Animation": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "width": { + "type": "integer", + "required": true + }, + "height": { + "type": "integer", + "required": true + }, + "duration": { + "type": "integer", + "required": true + }, + "thumbnail": { + "type": "PhotoSize" + }, + "file_name": { + "type": "string" + }, + "mime_type": { + "type": "string" + }, + "file_size": { + "type": "integer" + } + }, + "Audio": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "duration": { + "type": "integer", + "required": true + }, + "performer": { + "type": "string" + }, + "title": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "mime_type": { + "type": "string" + }, + "file_size": { + "type": "integer" + }, + "thumbnail": { + "type": "PhotoSize" + } + }, + "Document": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "thumbnail": { + "type": "PhotoSize" + }, + "file_name": { + "type": "string" + }, + "mime_type": { + "type": "string" + }, + "file_size": { + "type": "integer" + } + }, + "Story": { + "chat": { + "type": "Chat", + "required": true + }, + "id": { + "type": "integer", + "required": true + } + }, + "Video": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "width": { + "type": "integer", + "required": true + }, + "height": { + "type": "integer", + "required": true + }, + "duration": { + "type": "integer", + "required": true + }, + "thumbnail": { + "type": "PhotoSize" + }, + "file_name": { + "type": "string" + }, + "mime_type": { + "type": "string" + }, + "file_size": { + "type": "integer" + } + }, + "VideoNote": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "length": { + "type": "integer", + "required": true + }, + "duration": { + "type": "integer", + "required": true + }, + "thumbnail": { + "type": "PhotoSize" + }, + "file_size": { + "type": "integer" + } + }, + "Voice": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "duration": { + "type": "integer", + "required": true + }, + "mime_type": { + "type": "string" + }, + "file_size": { + "type": "integer" + } + }, + "PaidMediaInfo": { + "star_count": { + "type": "integer", + "required": true + }, + "paid_media": { + "type": "array", + "required": true, + "items": "PaidMedia" + } + }, + "PaidMedia": { + "type": [ + "PaidMediaPreview", + "PaidMediaPhoto", + "PaidMediaVideo" + ] + }, + "PaidMediaPreview": { + "type": { + "type": "string", + "required": true, + "required_value": "preview", + "default": "preview" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "duration": { + "type": "integer" + } + }, + "PaidMediaPhoto": { + "type": { + "type": "string", + "required": true, + "required_value": "photo", + "default": "photo" + }, + "photo": { + "type": "array", + "required": true, + "items": "PhotoSize" + } + }, + "PaidMediaVideo": { + "type": { + "type": "string", + "required": true, + "required_value": "video", + "default": "video" + }, + "video": { + "type": "Video", + "required": true + } + }, + "Contact": { + "phone_number": { + "type": "string", + "required": true + }, + "first_name": { + "type": "string", + "required": true + }, + "last_name": { + "type": "string" + }, + "user_id": { + "type": "integer" + }, + "vcard": { + "type": "string" + } + }, + "Dice": { + "emoji": { + "type": "string", + "required": true + }, + "value": { + "type": "integer", + "required": true + } + }, + "PollOption": { + "text": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 100 + }, + "text_entities": { + "type": "array", + "items": "MessageEntity" + }, + "voter_count": { + "type": "integer", + "required": true + } + }, + "InputPollOption": { + "text": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 100 + }, + "text_parse_mode": { + "type": "string" + }, + "text_entities": { + "type": "array", + "items": "MessageEntity" + } + }, + "PollAnswer": { + "poll_id": { + "type": "string", + "required": true + }, + "voter_chat": { + "type": "Chat" + }, + "user": { + "type": "User" + }, + "option_ids": { + "type": "array", + "required": true, + "items": "integer" + } + }, + "Poll": { + "id": { + "type": "string", + "required": true + }, + "question": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 300 + }, + "question_entities": { + "type": "array", + "items": "MessageEntity" + }, + "options": { + "type": "array", + "required": true, + "items": "PollOption" + }, + "total_voter_count": { + "type": "integer", + "required": true + }, + "is_closed": { + "type": "boolean", + "required": true + }, + "is_anonymous": { + "type": "boolean", + "required": true + }, + "type": { + "type": "string", + "required": true + }, + "allows_multiple_answers": { + "type": "boolean", + "required": true + }, + "correct_option_id": { + "type": "integer" + }, + "explanation": { + "type": "string", + "max_size": 200 + }, + "explanation_entities": { + "type": "array", + "items": "MessageEntity" + }, + "open_period": { + "type": "integer" + }, + "close_date": { + "type": "integer" + } + }, + "Location": { + "latitude": { + "type": "number", + "required": true + }, + "longitude": { + "type": "number", + "required": true + }, + "horizontal_accuracy": { + "type": "number" + }, + "live_period": { + "type": "integer" + }, + "heading": { + "type": "integer" + }, + "proximity_alert_radius": { + "type": "integer" + } + }, + "Venue": { + "location": { + "type": "Location", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "address": { + "type": "string", + "required": true + }, + "foursquare_id": { + "type": "string" + }, + "foursquare_type": { + "type": "string" + }, + "google_place_id": { + "type": "string" + }, + "google_place_type": { + "type": "string" + } + }, + "WebAppData": { + "data": { + "type": "string", + "required": true + }, + "button_text": { + "type": "string", + "required": true + } + }, + "ProximityAlertTriggered": { + "traveler": { + "type": "User", + "required": true + }, + "watcher": { + "type": "User", + "required": true + }, + "distance": { + "type": "integer", + "required": true + } + }, + "MessageAutoDeleteTimerChanged": { + "message_auto_delete_time": { + "type": "integer", + "required": true + } + }, + "ChatBoostAdded": { + "boost_count": { + "type": "integer", + "required": true + } + }, + "BackgroundFill": { + "type": [ + "BackgroundFillSolid", + "BackgroundFillGradient", + "BackgroundFillFreeformGradient" + ] + }, + "BackgroundFillSolid": { + "type": { + "type": "string", + "required": true, + "required_value": "solid", + "default": "solid" + }, + "color": { + "type": "integer", + "required": true + } + }, + "BackgroundFillGradient": { + "type": { + "type": "string", + "required": true, + "required_value": "gradient", + "default": "gradient" + }, + "top_color": { + "type": "integer", + "required": true + }, + "bottom_color": { + "type": "integer", + "required": true + }, + "rotation_angle": { + "type": "integer", + "required": true + } + }, + "BackgroundFillFreeformGradient": { + "type": { + "type": "string", + "required": true, + "required_value": "freeform_gradient", + "default": "freeform_gradient" + }, + "colors": { + "type": "array", + "required": true, + "items": "integer" + } + }, + "BackgroundType": { + "type": [ + "BackgroundTypeFill", + "BackgroundTypeWallpaper", + "BackgroundTypePattern", + "BackgroundTypeChatTheme" + ] + }, + "BackgroundTypeFill": { + "type": { + "type": "string", + "required": true, + "required_value": "fill", + "default": "fill" + }, + "fill": { + "type": "BackgroundFill", + "required": true + }, + "dark_theme_dimming": { + "type": "integer", + "required": true + } + }, + "BackgroundTypeWallpaper": { + "type": { + "type": "string", + "required": true, + "required_value": "wallpaper", + "default": "wallpaper" + }, + "document": { + "type": "Document", + "required": true + }, + "dark_theme_dimming": { + "type": "integer", + "required": true + }, + "is_blurred": { + "type": "boolean", + "default": true + }, + "is_moving": { + "type": "boolean", + "default": true + } + }, + "BackgroundTypePattern": { + "type": { + "type": "string", + "required": true, + "required_value": "pattern", + "default": "pattern" + }, + "document": { + "type": "Document", + "required": true + }, + "fill": { + "type": "BackgroundFill", + "required": true + }, + "intensity": { + "type": "integer", + "required": true + }, + "is_inverted": { + "type": "boolean", + "default": true + }, + "is_moving": { + "type": "boolean", + "default": true + } + }, + "BackgroundTypeChatTheme": { + "type": { + "type": "string", + "required": true, + "required_value": "chat_theme", + "default": "chat_theme" + }, + "theme_name": { + "type": "string", + "required": true + } + }, + "ChatBackground": { + "type": { + "type": "BackgroundType", + "required": true + } + }, + "ForumTopicCreated": { + "name": { + "type": "string", + "required": true + }, + "icon_color": { + "type": "integer", + "required": true + }, + "icon_custom_emoji_id": { + "type": "string" + } + }, + "ForumTopicClosed": { + }, + "ForumTopicEdited": { + "name": { + "type": "string" + }, + "icon_custom_emoji_id": { + "type": "string" + } + }, + "ForumTopicReopened": { + }, + "GeneralForumTopicHidden": { + }, + "GeneralForumTopicUnhidden": { + }, + "SharedUser": { + "user_id": { + "type": "integer", + "required": true + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "username": { + "type": "string" + }, + "photo": { + "type": "array", + "items": "PhotoSize" + } + }, + "UsersShared": { + "request_id": { + "type": "integer", + "required": true + }, + "users": { + "type": "array", + "required": true, + "items": "SharedUser" + } + }, + "ChatShared": { + "request_id": { + "type": "integer", + "required": true + }, + "chat_id": { + "type": "integer", + "required": true + }, + "title": { + "type": "string" + }, + "username": { + "type": "string" + }, + "photo": { + "type": "array", + "items": "PhotoSize" + } + }, + "WriteAccessAllowed": { + "from_request": { + "type": "boolean" + }, + "web_app_name": { + "type": "string" + }, + "from_attachment_menu": { + "type": "boolean" + } + }, + "VideoChatScheduled": { + "start_date": { + "type": "integer", + "required": true + } + }, + "VideoChatStarted": { + }, + "VideoChatEnded": { + "duration": { + "type": "integer", + "required": true + } + }, + "VideoChatParticipantsInvited": { + "users": { + "type": "array", + "required": true, + "items": "User" + } + }, + "GiveawayCreated": { + "prize_star_count": { + "type": "integer" + } + }, + "Giveaway": { + "chats": { + "type": "array", + "required": true, + "items": "Chat" + }, + "winners_selection_date": { + "type": "integer", + "required": true + }, + "winner_count": { + "type": "integer", + "required": true + }, + "only_new_members": { + "type": "boolean", + "default": true + }, + "has_public_winners": { + "type": "boolean", + "default": true + }, + "prize_description": { + "type": "string" + }, + "country_codes": { + "type": "array", + "items": "string" + }, + "prize_star_count": { + "type": "integer" + }, + "premium_subscription_month_count": { + "type": "integer" + } + }, + "GiveawayWinners": { + "chat": { + "type": "Chat", + "required": true + }, + "giveaway_message_id": { + "type": "integer", + "required": true + }, + "winners_selection_date": { + "type": "integer", + "required": true + }, + "winner_count": { + "type": "integer", + "required": true + }, + "winners": { + "type": "array", + "required": true, + "items": "User" + }, + "additional_chat_count": { + "type": "integer" + }, + "prize_star_count": { + "type": "integer" + }, + "premium_subscription_month_count": { + "type": "integer" + }, + "unclaimed_prize_count": { + "type": "integer" + }, + "only_new_members": { + "type": "boolean", + "default": true + }, + "was_refunded": { + "type": "boolean", + "default": true + }, + "prize_description": { + "type": "string" + } + }, + "GiveawayCompleted": { + "winner_count": { + "type": "integer", + "required": true + }, + "unclaimed_prize_count": { + "type": "integer" + }, + "giveaway_message": { + "type": "Message" + }, + "is_star_giveaway": { + "type": "boolean", + "default": true + } + }, + "LinkPreviewOptions": { + "is_disabled": { + "type": "boolean" + }, + "url": { + "type": "string" + }, + "prefer_small_media": { + "type": "boolean" + }, + "prefer_large_media": { + "type": "boolean" + }, + "show_above_text": { + "type": "boolean" + } + }, + "UserProfilePhotos": { + "total_count": { + "type": "integer", + "required": true + }, + "photos": { + "type": "array", + "required": true, + "items": { + "type": "array", + "items": "PhotoSize" + } + } + }, + "File": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "file_size": { + "type": "integer" + }, + "file_path": { + "type": "string" + } + }, + "WebAppInfo": { + "url": { + "type": "string", + "required": true + } + }, + "ReplyKeyboardMarkup": { + "keyboard": { + "type": "array", + "required": true, + "items": { + "type": "array", + "items": "KeyboardButton" + } + }, + "is_persistent": { + "type": "boolean", + "default": false + }, + "resize_keyboard": { + "type": "boolean", + "default": false + }, + "one_time_keyboard": { + "type": "boolean", + "default": false + }, + "input_field_placeholder": { + "type": "string", + "min_size": 1, + "max_size": 64 + }, + "selective": { + "type": "boolean" + } + }, + "KeyboardButton": { + "text": { + "type": "string", + "required": true + }, + "request_users": { + "type": "KeyboardButtonRequestUsers" + }, + "request_chat": { + "type": "KeyboardButtonRequestChat" + }, + "request_contact": { + "type": "boolean" + }, + "request_location": { + "type": "boolean" + }, + "request_poll": { + "type": "KeyboardButtonPollType" + }, + "web_app": { + "type": "WebAppInfo" + } + }, + "KeyboardButtonRequestUsers": { + "request_id": { + "type": "integer", + "required": true + }, + "user_is_bot": { + "type": "boolean" + }, + "user_is_premium": { + "type": "boolean" + }, + "max_quantity": { + "type": "integer", + "default": 1 + }, + "request_name": { + "type": "boolean" + }, + "request_username": { + "type": "boolean" + }, + "request_photo": { + "type": "boolean" + } + }, + "KeyboardButtonRequestChat": { + "request_id": { + "type": "integer", + "required": true + }, + "chat_is_channel": { + "type": "boolean", + "required": true + }, + "chat_is_forum": { + "type": "boolean" + }, + "chat_has_username": { + "type": "boolean" + }, + "chat_is_created": { + "type": "boolean" + }, + "user_administrator_rights": { + "type": "ChatAdministratorRights" + }, + "bot_administrator_rights": { + "type": "ChatAdministratorRights" + }, + "bot_is_member": { + "type": "boolean" + }, + "request_title": { + "type": "boolean" + }, + "request_username": { + "type": "boolean" + }, + "request_photo": { + "type": "boolean" + } + }, + "KeyboardButtonPollType": { + "type": { + "type": "string" + } + }, + "ReplyKeyboardRemove": { + "remove_keyboard": { + "type": "boolean", + "required": true, + "default": true + }, + "selective": { + "type": "boolean" + } + }, + "InlineKeyboardMarkup": { + "inline_keyboard": { + "type": "array", + "required": true, + "items": { + "type": "array", + "items": "InlineKeyboardButton" + } + } + }, + "InlineKeyboardButton": { + "text": { + "type": "string", + "required": true + }, + "url": { + "type": "string" + }, + "callback_data": { + "type": "string" + }, + "web_app": { + "type": "WebAppInfo" + }, + "login_url": { + "type": "LoginUrl" + }, + "switch_inline_query": { + "type": "string" + }, + "switch_inline_query_current_chat": { + "type": "string" + }, + "switch_inline_query_chosen_chat": { + "type": "SwitchInlineQueryChosenChat" + }, + "copy_text": { + "type": "CopyTextButton" + }, + "callback_game": { + "type": "CallbackGame" + }, + "pay": { + "type": "boolean" + } + }, + "LoginUrl": { + "url": { + "type": "string", + "required": true + }, + "forward_text": { + "type": "string" + }, + "bot_username": { + "type": "string" + }, + "request_write_access": { + "type": "boolean" + } + }, + "SwitchInlineQueryChosenChat": { + "query": { + "type": "string" + }, + "allow_user_chats": { + "type": "boolean" + }, + "allow_bot_chats": { + "type": "boolean" + }, + "allow_group_chats": { + "type": "boolean" + }, + "allow_channel_chats": { + "type": "boolean" + } + }, + "CopyTextButton": { + "text": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 256 + } + }, + "CallbackQuery": { + "id": { + "type": "string", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "message": { + "type": "MaybeInaccessibleMessage" + }, + "inline_message_id": { + "type": "string" + }, + "chat_instance": { + "type": "string", + "required": true + }, + "data": { + "type": "string" + }, + "game_short_name": { + "type": "string" + } + }, + "ForceReply": { + "force_reply": { + "type": "boolean", + "required": true, + "default": true + }, + "input_field_placeholder": { + "type": "string", + "min_size": 1, + "max_size": 64 + }, + "selective": { + "type": "boolean" + } + }, + "ChatPhoto": { + "small_file_id": { + "type": "string", + "required": true + }, + "small_file_unique_id": { + "type": "string", + "required": true + }, + "big_file_id": { + "type": "string", + "required": true + }, + "big_file_unique_id": { + "type": "string", + "required": true + } + }, + "ChatInviteLink": { + "invite_link": { + "type": "string", + "required": true + }, + "creator": { + "type": "User", + "required": true + }, + "creates_join_request": { + "type": "boolean", + "required": true + }, + "is_primary": { + "type": "boolean", + "required": true + }, + "is_revoked": { + "type": "boolean", + "required": true + }, + "name": { + "type": "string" + }, + "expire_date": { + "type": "integer" + }, + "member_limit": { + "type": "integer" + }, + "pending_join_request_count": { + "type": "integer" + }, + "subscription_period": { + "type": "integer" + }, + "subscription_price": { + "type": "integer" + } + }, + "ChatAdministratorRights": { + "is_anonymous": { + "type": "boolean", + "required": true + }, + "can_manage_chat": { + "type": "boolean", + "required": true + }, + "can_delete_messages": { + "type": "boolean", + "required": true + }, + "can_manage_video_chats": { + "type": "boolean", + "required": true + }, + "can_restrict_members": { + "type": "boolean", + "required": true + }, + "can_promote_members": { + "type": "boolean", + "required": true + }, + "can_change_info": { + "type": "boolean", + "required": true + }, + "can_invite_users": { + "type": "boolean", + "required": true + }, + "can_post_stories": { + "type": "boolean", + "required": true + }, + "can_edit_stories": { + "type": "boolean", + "required": true + }, + "can_delete_stories": { + "type": "boolean", + "required": true + }, + "can_post_messages": { + "type": "boolean" + }, + "can_edit_messages": { + "type": "boolean" + }, + "can_pin_messages": { + "type": "boolean" + }, + "can_manage_topics": { + "type": "boolean" + } + }, + "ChatMemberUpdated": { + "chat": { + "type": "Chat", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "date": { + "type": "integer", + "required": true + }, + "old_chat_member": { + "type": "ChatMember", + "required": true + }, + "new_chat_member": { + "type": "ChatMember", + "required": true + }, + "invite_link": { + "type": "ChatInviteLink" + }, + "via_join_request": { + "type": "boolean" + }, + "via_chat_folder_invite_link": { + "type": "boolean" + } + }, + "ChatMember": { + "type": [ + "ChatMemberOwner", + "ChatMemberAdministrator", + "ChatMemberMember", + "ChatMemberRestricted", + "ChatMemberLeft", + "ChatMemberBanned" + ] + }, + "ChatMemberOwner": { + "status": { + "type": "string", + "required": true, + "required_value": "creator", + "default": "creator" + }, + "user": { + "type": "User", + "required": true + }, + "is_anonymous": { + "type": "boolean", + "required": true + }, + "custom_title": { + "type": "string" + } + }, + "ChatMemberAdministrator": { + "status": { + "type": "string", + "required": true, + "required_value": "administrator", + "default": "administrator" + }, + "user": { + "type": "User", + "required": true + }, + "can_be_edited": { + "type": "boolean", + "required": true + }, + "is_anonymous": { + "type": "boolean", + "required": true + }, + "can_manage_chat": { + "type": "boolean", + "required": true + }, + "can_delete_messages": { + "type": "boolean", + "required": true + }, + "can_manage_video_chats": { + "type": "boolean", + "required": true + }, + "can_restrict_members": { + "type": "boolean", + "required": true + }, + "can_promote_members": { + "type": "boolean", + "required": true + }, + "can_change_info": { + "type": "boolean", + "required": true + }, + "can_invite_users": { + "type": "boolean", + "required": true + }, + "can_post_stories": { + "type": "boolean", + "required": true + }, + "can_edit_stories": { + "type": "boolean", + "required": true + }, + "can_delete_stories": { + "type": "boolean", + "required": true + }, + "can_post_messages": { + "type": "boolean" + }, + "can_edit_messages": { + "type": "boolean" + }, + "can_pin_messages": { + "type": "boolean" + }, + "can_manage_topics": { + "type": "boolean" + }, + "custom_title": { + "type": "string" + } + }, + "ChatMemberMember": { + "status": { + "type": "string", + "required": true, + "required_value": "member", + "default": "member" + }, + "user": { + "type": "User", + "required": true + }, + "until_date": { + "type": "integer" + } + }, + "ChatMemberRestricted": { + "status": { + "type": "string", + "required": true, + "required_value": "restricted", + "default": "restricted" + }, + "user": { + "type": "User", + "required": true + }, + "is_member": { + "type": "boolean", + "required": true + }, + "can_send_messages": { + "type": "boolean", + "required": true + }, + "can_send_audios": { + "type": "boolean", + "required": true + }, + "can_send_documents": { + "type": "boolean", + "required": true + }, + "can_send_photos": { + "type": "boolean", + "required": true + }, + "can_send_videos": { + "type": "boolean", + "required": true + }, + "can_send_video_notes": { + "type": "boolean", + "required": true + }, + "can_send_voice_notes": { + "type": "boolean", + "required": true + }, + "can_send_polls": { + "type": "boolean", + "required": true + }, + "can_send_other_messages": { + "type": "boolean", + "required": true + }, + "can_add_web_page_previews": { + "type": "boolean", + "required": true + }, + "can_change_info": { + "type": "boolean", + "required": true + }, + "can_invite_users": { + "type": "boolean", + "required": true + }, + "can_pin_messages": { + "type": "boolean", + "required": true + }, + "can_manage_topics": { + "type": "boolean", + "required": true + }, + "until_date": { + "type": "integer", + "required": true + } + }, + "ChatMemberLeft": { + "status": { + "type": "string", + "required": true, + "required_value": "left", + "default": "left" + }, + "user": { + "type": "User", + "required": true + } + }, + "ChatMemberBanned": { + "status": { + "type": "string", + "required": true, + "required_value": "kicked", + "default": "kicked" + }, + "user": { + "type": "User", + "required": true + }, + "until_date": { + "type": "integer", + "required": true + } + }, + "ChatJoinRequest": { + "chat": { + "type": "Chat", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "user_chat_id": { + "type": "integer", + "required": true + }, + "date": { + "type": "integer", + "required": true + }, + "bio": { + "type": "string" + }, + "invite_link": { + "type": "ChatInviteLink" + } + }, + "ChatPermissions": { + "can_send_messages": { + "type": "boolean" + }, + "can_send_audios": { + "type": "boolean" + }, + "can_send_documents": { + "type": "boolean" + }, + "can_send_photos": { + "type": "boolean" + }, + "can_send_videos": { + "type": "boolean" + }, + "can_send_video_notes": { + "type": "boolean" + }, + "can_send_voice_notes": { + "type": "boolean" + }, + "can_send_polls": { + "type": "boolean" + }, + "can_send_other_messages": { + "type": "boolean" + }, + "can_add_web_page_previews": { + "type": "boolean" + }, + "can_change_info": { + "type": "boolean" + }, + "can_invite_users": { + "type": "boolean" + }, + "can_pin_messages": { + "type": "boolean" + }, + "can_manage_topics": { + "type": "boolean" + } + }, + "Birthdate": { + "day": { + "type": "integer", + "required": true + }, + "month": { + "type": "integer", + "required": true + }, + "year": { + "type": "integer" + } + }, + "BusinessIntro": { + "title": { + "type": "string" + }, + "message": { + "type": "string" + }, + "sticker": { + "type": "Sticker" + } + }, + "BusinessLocation": { + "address": { + "type": "string", + "required": true + }, + "location": { + "type": "Location" + } + }, + "BusinessOpeningHoursInterval": { + "opening_minute": { + "type": "integer", + "required": true + }, + "closing_minute": { + "type": "integer", + "required": true + } + }, + "BusinessOpeningHours": { + "time_zone_name": { + "type": "string", + "required": true + }, + "opening_hours": { + "type": "array", + "required": true, + "items": "BusinessOpeningHoursInterval" + } + }, + "ChatLocation": { + "location": { + "type": "Location", + "required": true + }, + "address": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 64 + } + }, + "ReactionType": { + "type": [ + "ReactionTypeEmoji", + "ReactionTypeCustomEmoji", + "ReactionTypePaid" + ] + }, + "ReactionTypeEmoji": { + "type": { + "type": "string", + "required": true, + "required_value": "emoji", + "default": "emoji" + }, + "emoji": { + "type": "string", + "required": true + } + }, + "ReactionTypeCustomEmoji": { + "type": { + "type": "string", + "required": true, + "required_value": "custom_emoji", + "default": "custom_emoji" + }, + "custom_emoji_id": { + "type": "string", + "required": true + } + }, + "ReactionTypePaid": { + "type": { + "type": "string", + "required": true, + "required_value": "paid", + "default": "paid" + } + }, + "ReactionCount": { + "type": { + "type": "ReactionType", + "required": true + }, + "total_count": { + "type": "integer", + "required": true + } + }, + "MessageReactionUpdated": { + "chat": { + "type": "Chat", + "required": true + }, + "message_id": { + "type": "integer", + "required": true + }, + "user": { + "type": "User" + }, + "actor_chat": { + "type": "Chat" + }, + "date": { + "type": "integer", + "required": true + }, + "old_reaction": { + "type": "array", + "required": true, + "items": "ReactionType" + }, + "new_reaction": { + "type": "array", + "required": true, + "items": "ReactionType" + } + }, + "MessageReactionCountUpdated": { + "chat": { + "type": "Chat", + "required": true + }, + "message_id": { + "type": "integer", + "required": true + }, + "date": { + "type": "integer", + "required": true + }, + "reactions": { + "type": "array", + "required": true, + "items": "ReactionCount" + } + }, + "ForumTopic": { + "message_thread_id": { + "type": "integer", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "icon_color": { + "type": "integer", + "required": true + }, + "icon_custom_emoji_id": { + "type": "string" + } + }, + "BotCommand": { + "command": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 32 + }, + "description": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 256 + } + }, + "BotCommandScope": { + "type": [ + "BotCommandScopeDefault", + "BotCommandScopeAllPrivateChats", + "BotCommandScopeAllGroupChats", + "BotCommandScopeAllChatAdministrators", + "BotCommandScopeChat", + "BotCommandScopeChatAdministrators", + "BotCommandScopeChatMember" + ] + }, + "BotCommandScopeDefault": { + "type": { + "type": "string", + "required": true, + "required_value": "default", + "default": "default" + } + }, + "BotCommandScopeAllPrivateChats": { + "type": { + "type": "string", + "required": true, + "required_value": "all_private_chats", + "default": "all_private_chats" + } + }, + "BotCommandScopeAllGroupChats": { + "type": { + "type": "string", + "required": true, + "required_value": "all_group_chats", + "default": "all_group_chats" + } + }, + "BotCommandScopeAllChatAdministrators": { + "type": { + "type": "string", + "required": true, + "required_value": "all_chat_administrators", + "default": "all_chat_administrators" + } + }, + "BotCommandScopeChat": { + "type": { + "type": "string", + "required": true, + "required_value": "chat", + "default": "chat" + }, + "chat_id": { + "type": [ + "integer", + "string" + ], + "required": true + } + }, + "BotCommandScopeChatAdministrators": { + "type": { + "type": "string", + "required": true, + "required_value": "chat_administrators", + "default": "chat_administrators" + }, + "chat_id": { + "type": [ + "integer", + "string" + ], + "required": true + } + }, + "BotCommandScopeChatMember": { + "type": { + "type": "string", + "required": true, + "required_value": "chat_member", + "default": "chat_member" + }, + "chat_id": { + "type": [ + "integer", + "string" + ], + "required": true + }, + "user_id": { + "type": "integer", + "required": true + } + }, + "BotName": { + "name": { + "type": "string", + "required": true + } + }, + "BotDescription": { + "description": { + "type": "string", + "required": true + } + }, + "BotShortDescription": { + "short_description": { + "type": "string", + "required": true + } + }, + "MenuButton": { + "type": [ + "MenuButtonCommands", + "MenuButtonWebApp", + "MenuButtonDefault" + ] + }, + "MenuButtonCommands": { + "type": { + "type": "string", + "required": true, + "required_value": "commands", + "default": "commands" + } + }, + "MenuButtonWebApp": { + "type": { + "type": "string", + "required": true, + "required_value": "web_app", + "default": "web_app" + }, + "text": { + "type": "string", + "required": true + }, + "web_app": { + "type": "WebAppInfo", + "required": true + } + }, + "MenuButtonDefault": { + "type": { + "type": "string", + "required": true, + "required_value": "default", + "default": "default" + } + }, + "ChatBoostSource": { + "type": [ + "ChatBoostSourcePremium", + "ChatBoostSourceGiftCode", + "ChatBoostSourceGiveaway" + ] + }, + "ChatBoostSourcePremium": { + "source": { + "type": "string", + "required": true, + "required_value": "premium", + "default": "premium" + }, + "user": { + "type": "User", + "required": true + } + }, + "ChatBoostSourceGiftCode": { + "source": { + "type": "string", + "required": true, + "required_value": "gift_code", + "default": "gift_code" + }, + "user": { + "type": "User", + "required": true + } + }, + "ChatBoostSourceGiveaway": { + "source": { + "type": "string", + "required": true, + "required_value": "giveaway", + "default": "giveaway" + }, + "giveaway_message_id": { + "type": "integer", + "required": true + }, + "user": { + "type": "User" + }, + "prize_star_count": { + "type": "integer" + }, + "is_unclaimed": { + "type": "boolean", + "default": true + } + }, + "ChatBoost": { + "boost_id": { + "type": "string", + "required": true + }, + "add_date": { + "type": "integer", + "required": true + }, + "expiration_date": { + "type": "integer", + "required": true + }, + "source": { + "type": "ChatBoostSource", + "required": true + } + }, + "ChatBoostUpdated": { + "chat": { + "type": "Chat", + "required": true + }, + "boost": { + "type": "ChatBoost", + "required": true + } + }, + "ChatBoostRemoved": { + "chat": { + "type": "Chat", + "required": true + }, + "boost_id": { + "type": "string", + "required": true + }, + "remove_date": { + "type": "integer", + "required": true + }, + "source": { + "type": "ChatBoostSource", + "required": true + } + }, + "UserChatBoosts": { + "boosts": { + "type": "array", + "required": true, + "items": "ChatBoost" + } + }, + "BusinessConnection": { + "id": { + "type": "string", + "required": true + }, + "user": { + "type": "User", + "required": true + }, + "user_chat_id": { + "type": "integer", + "required": true + }, + "date": { + "type": "integer", + "required": true + }, + "can_reply": { + "type": "boolean", + "required": true + }, + "is_enabled": { + "type": "boolean", + "required": true + } + }, + "BusinessMessagesDeleted": { + "business_connection_id": { + "type": "string", + "required": true + }, + "chat": { + "type": "Chat", + "required": true + }, + "message_ids": { + "type": "array", + "required": true, + "items": "integer" + } + }, + "ResponseParameters": { + "migrate_to_chat_id": { + "type": "integer" + }, + "retry_after": { + "type": "integer" + } + }, + "InputMedia": { + "type": [ + "InputMediaAnimation", + "InputMediaDocument", + "InputMediaAudio", + "InputMediaPhoto", + "InputMediaVideo" + ] + }, + "InputMediaPhoto": { + "type": { + "type": "string", + "required": true, + "required_value": "photo", + "default": "photo" + }, + "media": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "has_spoiler": { + "type": "boolean" + } + }, + "InputMediaVideo": { + "type": { + "type": "string", + "required": true, + "required_value": "video", + "default": "video" + }, + "media": { + "type": "string", + "required": true + }, + "thumbnail": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "duration": { + "type": "integer" + }, + "supports_streaming": { + "type": "boolean" + }, + "has_spoiler": { + "type": "boolean" + } + }, + "InputMediaAnimation": { + "type": { + "type": "string", + "required": true, + "required_value": "animation", + "default": "animation" + }, + "media": { + "type": "string", + "required": true + }, + "thumbnail": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "duration": { + "type": "integer" + }, + "has_spoiler": { + "type": "boolean" + } + }, + "InputMediaAudio": { + "type": { + "type": "string", + "required": true, + "required_value": "audio", + "default": "audio" + }, + "media": { + "type": "string", + "required": true + }, + "thumbnail": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "duration": { + "type": "integer" + }, + "performer": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "InputMediaDocument": { + "type": { + "type": "string", + "required": true, + "required_value": "document", + "default": "document" + }, + "media": { + "type": "string", + "required": true + }, + "thumbnail": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "disable_content_type_detection": { + "type": "boolean" + } + }, + "InputPaidMedia": { + "type": [ + "InputPaidMediaPhoto", + "InputPaidMediaVideo" + ] + }, + "InputPaidMediaPhoto": { + "type": { + "type": "string", + "required": true, + "required_value": "photo", + "default": "photo" + }, + "media": { + "type": "string", + "required": true + } + }, + "InputPaidMediaVideo": { + "type": { + "type": "string", + "required": true, + "required_value": "video", + "default": "video" + }, + "media": { + "type": "string", + "required": true + }, + "thumbnail": { + "type": "string" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "duration": { + "type": "integer" + }, + "supports_streaming": { + "type": "boolean" + } + }, + "Sticker": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "type": { + "type": "string", + "required": true + }, + "width": { + "type": "integer", + "required": true + }, + "height": { + "type": "integer", + "required": true + }, + "is_animated": { + "type": "boolean", + "required": true + }, + "is_video": { + "type": "boolean", + "required": true + }, + "thumbnail": { + "type": "PhotoSize" + }, + "emoji": { + "type": "string" + }, + "set_name": { + "type": "string" + }, + "premium_animation": { + "type": "File" + }, + "mask_position": { + "type": "MaskPosition" + }, + "custom_emoji_id": { + "type": "string" + }, + "needs_repainting": { + "type": "boolean", + "default": true + }, + "file_size": { + "type": "integer" + } + }, + "StickerSet": { + "name": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "sticker_type": { + "type": "string", + "required": true + }, + "stickers": { + "type": "array", + "required": true, + "items": "Sticker" + }, + "thumbnail": { + "type": "PhotoSize" + } + }, + "MaskPosition": { + "point": { + "type": "string", + "required": true + }, + "x_shift": { + "type": "number", + "required": true + }, + "y_shift": { + "type": "number", + "required": true + }, + "scale": { + "type": "number", + "required": true + } + }, + "InputSticker": { + "sticker": { + "type": "string", + "required": true + }, + "format": { + "type": "string", + "required": true + }, + "emoji_list": { + "type": "array", + "required": true, + "items": "string" + }, + "mask_position": { + "type": "MaskPosition" + }, + "keywords": { + "type": "array", + "items": "string" + } + }, + "Gift": { + "id": { + "type": "string", + "required": true + }, + "sticker": { + "type": "Sticker", + "required": true + }, + "star_count": { + "type": "integer", + "required": true + }, + "total_count": { + "type": "integer" + }, + "remaining_count": { + "type": "integer" + } + }, + "Gifts": { + "gifts": { + "type": "array", + "required": true, + "items": "Gift" + } + }, + "InlineQuery": { + "id": { + "type": "string", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "query": { + "type": "string", + "required": true + }, + "offset": { + "type": "string", + "required": true + }, + "chat_type": { + "type": "string" + }, + "location": { + "type": "Location" + } + }, + "InlineQueryResultsButton": { + "text": { + "type": "string", + "required": true + }, + "web_app": { + "type": "WebAppInfo" + }, + "start_parameter": { + "type": "string", + "min_size": 1, + "max_size": 64 + } + }, + "InlineQueryResult": { + "type": [ + "InlineQueryResultCachedAudio", + "InlineQueryResultCachedDocument", + "InlineQueryResultCachedGif", + "InlineQueryResultCachedMpeg4Gif", + "InlineQueryResultCachedPhoto", + "InlineQueryResultCachedSticker", + "InlineQueryResultCachedVideo", + "InlineQueryResultCachedVoice", + "InlineQueryResultArticle", + "InlineQueryResultAudio", + "InlineQueryResultContact", + "InlineQueryResultGame", + "InlineQueryResultDocument", + "InlineQueryResultGif", + "InlineQueryResultLocation", + "InlineQueryResultMpeg4Gif", + "InlineQueryResultPhoto", + "InlineQueryResultVenue", + "InlineQueryResultVideo", + "InlineQueryResultVoice" + ] + }, + "InlineQueryResultArticle": { + "type": { + "type": "string", + "required": true, + "required_value": "article", + "default": "article" + }, + "id": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "input_message_content": { + "type": "InputMessageContent", + "required": true + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "url": { + "type": "string" + }, + "hide_url": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "thumbnail_url": { + "type": "string" + }, + "thumbnail_width": { + "type": "integer" + }, + "thumbnail_height": { + "type": "integer" + } + }, + "InlineQueryResultPhoto": { + "type": { + "type": "string", + "required": true, + "required_value": "photo", + "default": "photo" + }, + "id": { + "type": "string", + "required": true + }, + "photo_url": { + "type": "string", + "required": true + }, + "thumbnail_url": { + "type": "string", + "required": true + }, + "photo_width": { + "type": "integer" + }, + "photo_height": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultGif": { + "type": { + "type": "string", + "required": true, + "required_value": "gif", + "default": "gif" + }, + "id": { + "type": "string", + "required": true + }, + "gif_url": { + "type": "string", + "required": true + }, + "gif_width": { + "type": "integer" + }, + "gif_height": { + "type": "integer" + }, + "gif_duration": { + "type": "integer" + }, + "thumbnail_url": { + "type": "string", + "required": true + }, + "thumbnail_mime_type": { + "type": "string", + "default": "image/jpeg" + }, + "title": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultMpeg4Gif": { + "type": { + "type": "string", + "required": true, + "required_value": "mpeg4_gif", + "default": "mpeg4_gif" + }, + "id": { + "type": "string", + "required": true + }, + "mpeg4_url": { + "type": "string", + "required": true + }, + "mpeg4_width": { + "type": "integer" + }, + "mpeg4_height": { + "type": "integer" + }, + "mpeg4_duration": { + "type": "integer" + }, + "thumbnail_url": { + "type": "string", + "required": true + }, + "thumbnail_mime_type": { + "type": "string", + "default": "image/jpeg" + }, + "title": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultVideo": { + "type": { + "type": "string", + "required": true, + "required_value": "video", + "default": "video" + }, + "id": { + "type": "string", + "required": true + }, + "video_url": { + "type": "string", + "required": true + }, + "mime_type": { + "type": "string", + "required": true + }, + "thumbnail_url": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "video_width": { + "type": "integer" + }, + "video_height": { + "type": "integer" + }, + "video_duration": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultAudio": { + "type": { + "type": "string", + "required": true, + "required_value": "audio", + "default": "audio" + }, + "id": { + "type": "string", + "required": true + }, + "audio_url": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "performer": { + "type": "string" + }, + "audio_duration": { + "type": "integer" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultVoice": { + "type": { + "type": "string", + "required": true, + "required_value": "voice", + "default": "voice" + }, + "id": { + "type": "string", + "required": true + }, + "voice_url": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "voice_duration": { + "type": "integer" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultDocument": { + "type": { + "type": "string", + "required": true, + "required_value": "document", + "default": "document" + }, + "id": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "document_url": { + "type": "string", + "required": true + }, + "mime_type": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + }, + "thumbnail_url": { + "type": "string" + }, + "thumbnail_width": { + "type": "integer" + }, + "thumbnail_height": { + "type": "integer" + } + }, + "InlineQueryResultLocation": { + "type": { + "type": "string", + "required": true, + "required_value": "location", + "default": "location" + }, + "id": { + "type": "string", + "required": true + }, + "latitude": { + "type": "number", + "required": true + }, + "longitude": { + "type": "number", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "horizontal_accuracy": { + "type": "number" + }, + "live_period": { + "type": "integer" + }, + "heading": { + "type": "integer" + }, + "proximity_alert_radius": { + "type": "integer" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + }, + "thumbnail_url": { + "type": "string" + }, + "thumbnail_width": { + "type": "integer" + }, + "thumbnail_height": { + "type": "integer" + } + }, + "InlineQueryResultVenue": { + "type": { + "type": "string", + "required": true, + "required_value": "venue", + "default": "venue" + }, + "id": { + "type": "string", + "required": true + }, + "latitude": { + "type": "number", + "required": true + }, + "longitude": { + "type": "number", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "address": { + "type": "string", + "required": true + }, + "foursquare_id": { + "type": "string" + }, + "foursquare_type": { + "type": "string" + }, + "google_place_id": { + "type": "string" + }, + "google_place_type": { + "type": "string" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + }, + "thumbnail_url": { + "type": "string" + }, + "thumbnail_width": { + "type": "integer" + }, + "thumbnail_height": { + "type": "integer" + } + }, + "InlineQueryResultContact": { + "type": { + "type": "string", + "required": true, + "required_value": "contact", + "default": "contact" + }, + "id": { + "type": "string", + "required": true + }, + "phone_number": { + "type": "string", + "required": true + }, + "first_name": { + "type": "string", + "required": true + }, + "last_name": { + "type": "string" + }, + "vcard": { + "type": "string" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + }, + "thumbnail_url": { + "type": "string" + }, + "thumbnail_width": { + "type": "integer" + }, + "thumbnail_height": { + "type": "integer" + } + }, + "InlineQueryResultGame": { + "type": { + "type": "string", + "required": true, + "required_value": "game", + "default": "game" + }, + "id": { + "type": "string", + "required": true + }, + "game_short_name": { + "type": "string", + "required": true + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + } + }, + "InlineQueryResultCachedPhoto": { + "type": { + "type": "string", + "required": true, + "required_value": "photo", + "default": "photo" + }, + "id": { + "type": "string", + "required": true + }, + "photo_file_id": { + "type": "string", + "required": true + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedGif": { + "type": { + "type": "string", + "required": true, + "required_value": "gif", + "default": "gif" + }, + "id": { + "type": "string", + "required": true + }, + "gif_file_id": { + "type": "string", + "required": true + }, + "title": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedMpeg4Gif": { + "type": { + "type": "string", + "required": true, + "required_value": "mpeg4_gif", + "default": "mpeg4_gif" + }, + "id": { + "type": "string", + "required": true + }, + "mpeg4_file_id": { + "type": "string", + "required": true + }, + "title": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedSticker": { + "type": { + "type": "string", + "required": true, + "required_value": "sticker", + "default": "sticker" + }, + "id": { + "type": "string", + "required": true + }, + "sticker_file_id": { + "type": "string", + "required": true + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedDocument": { + "type": { + "type": "string", + "required": true, + "required_value": "document", + "default": "document" + }, + "id": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "document_file_id": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedVideo": { + "type": { + "type": "string", + "required": true, + "required_value": "video", + "default": "video" + }, + "id": { + "type": "string", + "required": true + }, + "video_file_id": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "show_caption_above_media": { + "type": "boolean" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedVoice": { + "type": { + "type": "string", + "required": true, + "required_value": "voice", + "default": "voice" + }, + "id": { + "type": "string", + "required": true + }, + "voice_file_id": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InlineQueryResultCachedAudio": { + "type": { + "type": "string", + "required": true, + "required_value": "audio", + "default": "audio" + }, + "id": { + "type": "string", + "required": true + }, + "audio_file_id": { + "type": "string", + "required": true + }, + "caption": { + "type": "string", + "max_size": 1024 + }, + "parse_mode": { + "type": "string" + }, + "caption_entities": { + "type": "array", + "items": "MessageEntity" + }, + "reply_markup": { + "type": "InlineKeyboardMarkup" + }, + "input_message_content": { + "type": "InputMessageContent" + } + }, + "InputMessageContent": { + "type": [ + "InputTextMessageContent", + "InputLocationMessageContent", + "InputVenueMessageContent", + "InputContactMessageContent", + "InputInvoiceMessageContent" + ] + }, + "InputTextMessageContent": { + "message_text": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 4096 + }, + "parse_mode": { + "type": "string" + }, + "entities": { + "type": "array", + "items": "MessageEntity" + }, + "link_preview_options": { + "type": "LinkPreviewOptions" + } + }, + "InputLocationMessageContent": { + "latitude": { + "type": "number", + "required": true + }, + "longitude": { + "type": "number", + "required": true + }, + "horizontal_accuracy": { + "type": "number" + }, + "live_period": { + "type": "integer" + }, + "heading": { + "type": "integer" + }, + "proximity_alert_radius": { + "type": "integer" + } + }, + "InputVenueMessageContent": { + "latitude": { + "type": "number", + "required": true + }, + "longitude": { + "type": "number", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "address": { + "type": "string", + "required": true + }, + "foursquare_id": { + "type": "string" + }, + "foursquare_type": { + "type": "string" + }, + "google_place_id": { + "type": "string" + }, + "google_place_type": { + "type": "string" + } + }, + "InputContactMessageContent": { + "phone_number": { + "type": "string", + "required": true + }, + "first_name": { + "type": "string", + "required": true + }, + "last_name": { + "type": "string" + }, + "vcard": { + "type": "string" + } + }, + "InputInvoiceMessageContent": { + "title": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 32 + }, + "description": { + "type": "string", + "required": true, + "min_size": 1, + "max_size": 255 + }, + "payload": { + "type": "string", + "required": true + }, + "provider_token": { + "type": "string" + }, + "currency": { + "type": "string", + "required": true + }, + "prices": { + "type": "array", + "required": true, + "items": "LabeledPrice" + }, + "max_tip_amount": { + "type": "integer", + "default": 0 + }, + "suggested_tip_amounts": { + "type": "array", + "items": "integer" + }, + "provider_data": { + "type": "string" + }, + "photo_url": { + "type": "string" + }, + "photo_size": { + "type": "integer" + }, + "photo_width": { + "type": "integer" + }, + "photo_height": { + "type": "integer" + }, + "need_name": { + "type": "boolean" + }, + "need_phone_number": { + "type": "boolean" + }, + "need_email": { + "type": "boolean" + }, + "need_shipping_address": { + "type": "boolean" + }, + "send_phone_number_to_provider": { + "type": "boolean" + }, + "send_email_to_provider": { + "type": "boolean" + }, + "is_flexible": { + "type": "boolean" + } + }, + "ChosenInlineResult": { + "result_id": { + "type": "string", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "location": { + "type": "Location" + }, + "inline_message_id": { + "type": "string" + }, + "query": { + "type": "string", + "required": true + } + }, + "SentWebAppMessage": { + "inline_message_id": { + "type": "string" + } + }, + "PreparedInlineMessage": { + "id": { + "type": "string", + "required": true + }, + "expiration_date": { + "type": "integer", + "required": true + } + }, + "LabeledPrice": { + "label": { + "type": "string", + "required": true + }, + "amount": { + "type": "integer", + "required": true + } + }, + "Invoice": { + "title": { + "type": "string", + "required": true + }, + "description": { + "type": "string", + "required": true + }, + "start_parameter": { + "type": "string", + "required": true + }, + "currency": { + "type": "string", + "required": true + }, + "total_amount": { + "type": "integer", + "required": true + } + }, + "ShippingAddress": { + "country_code": { + "type": "string", + "required": true + }, + "state": { + "type": "string", + "required": true + }, + "city": { + "type": "string", + "required": true + }, + "street_line1": { + "type": "string", + "required": true + }, + "street_line2": { + "type": "string", + "required": true + }, + "post_code": { + "type": "string", + "required": true + } + }, + "OrderInfo": { + "name": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "email": { + "type": "string" + }, + "shipping_address": { + "type": "ShippingAddress" + } + }, + "ShippingOption": { + "id": { + "type": "string", + "required": true + }, + "title": { + "type": "string", + "required": true + }, + "prices": { + "type": "array", + "required": true, + "items": "LabeledPrice" + } + }, + "SuccessfulPayment": { + "currency": { + "type": "string", + "required": true + }, + "total_amount": { + "type": "integer", + "required": true + }, + "invoice_payload": { + "type": "string", + "required": true + }, + "subscription_expiration_date": { + "type": "integer" + }, + "is_recurring": { + "type": "boolean", + "default": true + }, + "is_first_recurring": { + "type": "boolean", + "default": true + }, + "shipping_option_id": { + "type": "string" + }, + "order_info": { + "type": "OrderInfo" + }, + "telegram_payment_charge_id": { + "type": "string", + "required": true + }, + "provider_payment_charge_id": { + "type": "string", + "required": true + } + }, + "RefundedPayment": { + "currency": { + "type": "string", + "required": true, + "required_value": "XTR", + "default": "XTR" + }, + "total_amount": { + "type": "integer", + "required": true + }, + "invoice_payload": { + "type": "string", + "required": true + }, + "telegram_payment_charge_id": { + "type": "string", + "required": true + }, + "provider_payment_charge_id": { + "type": "string" + } + }, + "ShippingQuery": { + "id": { + "type": "string", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "invoice_payload": { + "type": "string", + "required": true + }, + "shipping_address": { + "type": "ShippingAddress", + "required": true + } + }, + "PreCheckoutQuery": { + "id": { + "type": "string", + "required": true + }, + "from": { + "type": "User", + "required": true + }, + "currency": { + "type": "string", + "required": true + }, + "total_amount": { + "type": "integer", + "required": true + }, + "invoice_payload": { + "type": "string", + "required": true + }, + "shipping_option_id": { + "type": "string" + }, + "order_info": { + "type": "OrderInfo" + } + }, + "PaidMediaPurchased": { + "from": { + "type": "User", + "required": true + }, + "paid_media_payload": { + "type": "string", + "required": true + } + }, + "RevenueWithdrawalState": { + "type": [ + "RevenueWithdrawalStatePending", + "RevenueWithdrawalStateSucceeded", + "RevenueWithdrawalStateFailed" + ] + }, + "RevenueWithdrawalStatePending": { + "type": { + "type": "string", + "required": true, + "required_value": "pending", + "default": "pending" + } + }, + "RevenueWithdrawalStateSucceeded": { + "type": { + "type": "string", + "required": true, + "required_value": "succeeded", + "default": "succeeded" + }, + "date": { + "type": "integer", + "required": true + }, + "url": { + "type": "string", + "required": true + } + }, + "RevenueWithdrawalStateFailed": { + "type": { + "type": "string", + "required": true, + "required_value": "failed", + "default": "failed" + } + }, + "TransactionPartner": { + "type": [ + "TransactionPartnerUser", + "TransactionPartnerFragment", + "TransactionPartnerTelegramAds", + "TransactionPartnerTelegramApi", + "TransactionPartnerOther" + ] + }, + "TransactionPartnerUser": { + "type": { + "type": "string", + "required": true, + "required_value": "user", + "default": "user" + }, + "user": { + "type": "User", + "required": true + }, + "invoice_payload": { + "type": "string" + }, + "subscription_period": { + "type": "integer" + }, + "paid_media": { + "type": "array", + "items": "PaidMedia" + }, + "paid_media_payload": { + "type": "string" + }, + "gift": { + "type": "Gift" + } + }, + "TransactionPartnerFragment": { + "type": { + "type": "string", + "required": true, + "required_value": "fragment", + "default": "fragment" + }, + "withdrawal_state": { + "type": "RevenueWithdrawalState" + } + }, + "TransactionPartnerTelegramAds": { + "type": { + "type": "string", + "required": true, + "required_value": "telegram_ads", + "default": "telegram_ads" + } + }, + "TransactionPartnerTelegramApi": { + "type": { + "type": "string", + "required": true, + "required_value": "telegram_api", + "default": "telegram_api" + }, + "request_count": { + "type": "integer", + "required": true + } + }, + "TransactionPartnerOther": { + "type": { + "type": "string", + "required": true, + "required_value": "other", + "default": "other" + } + }, + "StarTransaction": { + "id": { + "type": "string", + "required": true + }, + "amount": { + "type": "integer", + "required": true + }, + "date": { + "type": "integer", + "required": true + }, + "source": { + "type": "TransactionPartner" + }, + "receiver": { + "type": "TransactionPartner" + } + }, + "StarTransactions": { + "transactions": { + "type": "array", + "required": true, + "items": "StarTransaction" + } + }, + "PassportData": { + "data": { + "type": "array", + "required": true, + "items": "EncryptedPassportElement" + }, + "credentials": { + "type": "EncryptedCredentials", + "required": true + } + }, + "PassportFile": { + "file_id": { + "type": "string", + "required": true + }, + "file_unique_id": { + "type": "string", + "required": true + }, + "file_size": { + "type": "integer", + "required": true + }, + "file_date": { + "type": "integer", + "required": true + } + }, + "EncryptedPassportElement": { + "type": { + "type": "string", + "required": true + }, + "data": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "email": { + "type": "string" + }, + "files": { + "type": "array", + "items": "PassportFile" + }, + "front_side": { + "type": "PassportFile" + }, + "reverse_side": { + "type": "PassportFile" + }, + "selfie": { + "type": "PassportFile" + }, + "translation": { + "type": "array", + "items": "PassportFile" + }, + "hash": { + "type": "string", + "required": true + } + }, + "EncryptedCredentials": { + "data": { + "type": "string", + "required": true + }, + "hash": { + "type": "string", + "required": true + }, + "secret": { + "type": "string", + "required": true + } + }, + "PassportElementError": { + "type": [ + "PassportElementErrorDataField", + "PassportElementErrorFrontSide", + "PassportElementErrorReverseSide", + "PassportElementErrorSelfie", + "PassportElementErrorFile", + "PassportElementErrorFiles", + "PassportElementErrorTranslationFile", + "PassportElementErrorTranslationFiles", + "PassportElementErrorUnspecified" + ] + }, + "PassportElementErrorDataField": { + "source": { + "type": "string", + "required": true, + "required_value": "data", + "default": "data" + }, + "type": { + "type": "string", + "required": true + }, + "field_name": { + "type": "string", + "required": true + }, + "data_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorFrontSide": { + "source": { + "type": "string", + "required": true, + "required_value": "front_side", + "default": "front_side" + }, + "type": { + "type": "string", + "required": true + }, + "file_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorReverseSide": { + "source": { + "type": "string", + "required": true, + "required_value": "reverse_side", + "default": "reverse_side" + }, + "type": { + "type": "string", + "required": true + }, + "file_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorSelfie": { + "source": { + "type": "string", + "required": true, + "required_value": "selfie", + "default": "selfie" + }, + "type": { + "type": "string", + "required": true + }, + "file_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorFile": { + "source": { + "type": "string", + "required": true, + "required_value": "file", + "default": "file" + }, + "type": { + "type": "string", + "required": true + }, + "file_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorFiles": { + "source": { + "type": "string", + "required": true, + "required_value": "files", + "default": "files" + }, + "type": { + "type": "string", + "required": true + }, + "file_hashes": { + "type": "array", + "required": true, + "items": "string" + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorTranslationFile": { + "source": { + "type": "string", + "required": true, + "required_value": "translation_file", + "default": "translation_file" + }, + "type": { + "type": "string", + "required": true + }, + "file_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorTranslationFiles": { + "source": { + "type": "string", + "required": true, + "required_value": "translation_files", + "default": "translation_files" + }, + "type": { + "type": "string", + "required": true + }, + "file_hashes": { + "type": "array", + "required": true, + "items": "string" + }, + "message": { + "type": "string", + "required": true + } + }, + "PassportElementErrorUnspecified": { + "source": { + "type": "string", + "required": true, + "required_value": "unspecified", + "default": "unspecified" + }, + "type": { + "type": "string", + "required": true + }, + "element_hash": { + "type": "string", + "required": true + }, + "message": { + "type": "string", + "required": true + } + }, + "Game": { + "title": { + "type": "string", + "required": true + }, + "description": { + "type": "string", + "required": true + }, + "photo": { + "type": "array", + "required": true, + "items": "PhotoSize" + }, + "text": { + "type": "string", + "max_size": 4096 + }, + "text_entities": { + "type": "array", + "items": "MessageEntity" + }, + "animation": { + "type": "Animation" + } + }, + "CallbackGame": { + }, + "GameHighScore": { + "position": { + "type": "integer", + "required": true + }, + "user": { + "type": "User", + "required": true + }, + "score": { + "type": "integer", + "required": true + } + } +} \ No newline at end of file