Current section

Files

Jump to
nadia lib nadia model.ex
Raw

lib/nadia/model.ex

defmodule Nadia.Model do
@moduledoc """
Types used in Telegram Bot API.
## Reference
https://core.telegram.org/bots/api#available-types
"""
defmodule User do
defstruct id: nil,
is_bot: nil,
first_name: nil,
last_name: nil,
username: nil,
language_code: nil,
is_premium: nil,
added_to_attachment_menu: nil,
can_join_groups: nil,
can_read_all_group_messages: nil,
supports_guest_queries: nil,
supports_join_request_queries: nil,
supports_inline_queries: nil,
can_connect_to_business: nil,
has_main_web_app: nil,
has_topics_enabled: nil,
allows_users_to_create_topics: nil,
can_manage_bots: nil
@type t :: %User{
id: integer,
is_bot: boolean,
first_name: binary,
last_name: binary,
username: binary,
language_code: binary,
is_premium: boolean,
added_to_attachment_menu: boolean,
can_join_groups: boolean,
can_read_all_group_messages: boolean,
supports_guest_queries: boolean,
supports_join_request_queries: boolean,
supports_inline_queries: boolean,
can_connect_to_business: boolean,
has_main_web_app: boolean,
has_topics_enabled: boolean,
allows_users_to_create_topics: boolean,
can_manage_bots: boolean
}
end
defmodule BotCommand do
defstruct command: nil, description: nil
@type t :: %BotCommand{
command: binary,
description: binary
}
end
defmodule BotName do
defstruct name: nil
@type t :: %BotName{name: binary}
end
defmodule BotDescription do
defstruct description: nil
@type t :: %BotDescription{description: binary}
end
defmodule BotShortDescription do
defstruct short_description: nil
@type t :: %BotShortDescription{short_description: binary}
end
defmodule StarAmount do
defstruct amount: nil, nanostar_amount: nil
@type t :: %StarAmount{
amount: integer,
nanostar_amount: integer
}
end
defmodule RevenueWithdrawalState do
defstruct type: nil
@type t ::
%RevenueWithdrawalState{type: binary}
| RevenueWithdrawalStatePending.t()
| RevenueWithdrawalStateSucceeded.t()
| RevenueWithdrawalStateFailed.t()
end
defmodule RevenueWithdrawalStatePending do
defstruct type: nil
@type t :: %RevenueWithdrawalStatePending{type: binary}
end
defmodule RevenueWithdrawalStateSucceeded do
defstruct type: nil, date: nil, url: nil
@type t :: %RevenueWithdrawalStateSucceeded{
type: binary,
date: integer,
url: binary
}
end
defmodule RevenueWithdrawalStateFailed do
defstruct type: nil
@type t :: %RevenueWithdrawalStateFailed{type: binary}
end
defmodule AffiliateInfo do
defstruct affiliate_user: nil,
affiliate_chat: nil,
commission_per_mille: nil,
amount: nil,
nanostar_amount: nil
@type t :: %AffiliateInfo{
affiliate_user: User.t(),
affiliate_chat: Chat.t(),
commission_per_mille: integer,
amount: integer,
nanostar_amount: integer
}
end
defmodule TransactionPartner do
defstruct type: nil
@type t ::
%TransactionPartner{type: binary}
| TransactionPartnerUser.t()
| TransactionPartnerChat.t()
| TransactionPartnerAffiliateProgram.t()
| TransactionPartnerFragment.t()
| TransactionPartnerTelegramAds.t()
| TransactionPartnerTelegramApi.t()
| TransactionPartnerOther.t()
end
defmodule TransactionPartnerUser do
defstruct type: nil,
transaction_type: nil,
user: nil,
affiliate: nil,
invoice_payload: nil,
subscription_period: nil,
paid_media: [],
paid_media_payload: nil,
gift: nil,
premium_subscription_duration: nil
@type t :: %TransactionPartnerUser{
type: binary,
transaction_type: binary,
user: User.t(),
affiliate: AffiliateInfo.t(),
invoice_payload: binary,
subscription_period: integer,
paid_media: [PaidMedia.t()],
paid_media_payload: binary,
gift: Gift.t(),
premium_subscription_duration: integer
}
end
defmodule TransactionPartnerChat do
defstruct type: nil, chat: nil, gift: nil
@type t :: %TransactionPartnerChat{
type: binary,
chat: Chat.t(),
gift: Gift.t()
}
end
defmodule TransactionPartnerAffiliateProgram do
defstruct type: nil, sponsor_user: nil, commission_per_mille: nil
@type t :: %TransactionPartnerAffiliateProgram{
type: binary,
sponsor_user: User.t(),
commission_per_mille: integer
}
end
defmodule TransactionPartnerFragment do
defstruct type: nil, withdrawal_state: nil
@type t :: %TransactionPartnerFragment{
type: binary,
withdrawal_state: RevenueWithdrawalState.t()
}
end
defmodule TransactionPartnerTelegramAds do
defstruct type: nil
@type t :: %TransactionPartnerTelegramAds{type: binary}
end
defmodule TransactionPartnerTelegramApi do
defstruct type: nil, request_count: nil
@type t :: %TransactionPartnerTelegramApi{
type: binary,
request_count: integer
}
end
defmodule TransactionPartnerOther do
defstruct type: nil
@type t :: %TransactionPartnerOther{type: binary}
end
defmodule StarTransaction do
defstruct id: nil,
amount: nil,
nanostar_amount: nil,
date: nil,
source: nil,
receiver: nil
@type t :: %StarTransaction{
id: binary,
amount: integer,
nanostar_amount: integer,
date: integer,
source: TransactionPartner.t(),
receiver: TransactionPartner.t()
}
end
defmodule StarTransactions do
defstruct transactions: []
@type t :: %StarTransactions{transactions: [StarTransaction.t()]}
end
defmodule MenuButton do
defstruct type: nil
@type t ::
%MenuButton{type: binary}
| MenuButtonCommands.t()
| MenuButtonWebApp.t()
| MenuButtonDefault.t()
end
defmodule MenuButtonCommands do
defstruct type: nil
@type t :: %MenuButtonCommands{type: binary}
end
defmodule MenuButtonWebApp do
defstruct type: nil, text: nil, web_app: nil
@type t :: %MenuButtonWebApp{
type: binary,
text: binary,
web_app: any
}
end
defmodule MenuButtonDefault do
defstruct type: nil
@type t :: %MenuButtonDefault{type: binary}
end
defmodule ChatAdministratorRights do
defstruct is_anonymous: nil,
can_manage_chat: nil,
can_delete_messages: nil,
can_manage_video_chats: nil,
can_restrict_members: nil,
can_promote_members: nil,
can_change_info: nil,
can_invite_users: nil,
can_post_stories: nil,
can_edit_stories: nil,
can_delete_stories: nil,
can_post_messages: nil,
can_edit_messages: nil,
can_pin_messages: nil,
can_manage_topics: nil,
can_manage_direct_messages: nil,
can_manage_tags: nil
@type t :: %ChatAdministratorRights{
is_anonymous: boolean,
can_manage_chat: boolean,
can_delete_messages: boolean,
can_manage_video_chats: boolean,
can_restrict_members: boolean,
can_promote_members: boolean,
can_change_info: boolean,
can_invite_users: boolean,
can_post_stories: boolean,
can_edit_stories: boolean,
can_delete_stories: boolean,
can_post_messages: boolean,
can_edit_messages: boolean,
can_pin_messages: boolean,
can_manage_topics: boolean,
can_manage_direct_messages: boolean,
can_manage_tags: boolean
}
end
defmodule ChatPhoto do
defstruct small_file_id: nil,
small_file_unique_id: nil,
big_file_id: nil,
big_file_unique_id: nil
@type t :: %ChatPhoto{
small_file_id: binary,
small_file_unique_id: binary,
big_file_id: binary,
big_file_unique_id: binary
}
end
defmodule Chat do
defstruct id: nil,
type: nil,
title: nil,
username: nil,
first_name: nil,
last_name: nil,
photo: nil,
business_intro: nil,
business_location: nil,
business_opening_hours: nil
@type t :: %Chat{
id: integer,
type: binary,
title: binary,
username: binary,
first_name: binary,
last_name: binary,
photo: ChatPhoto.t(),
business_intro: BusinessIntro.t(),
business_location: BusinessLocation.t(),
business_opening_hours: BusinessOpeningHours.t()
}
end
defmodule Story do
defstruct chat: nil, id: nil
@type t :: %Story{
chat: Chat.t(),
id: integer
}
end
defmodule ChatInviteLink do
defstruct invite_link: nil,
creator: nil,
creates_join_request: nil,
is_primary: nil,
is_revoked: nil,
name: nil,
expire_date: nil,
member_limit: nil,
pending_join_request_count: nil,
subscription_period: nil,
subscription_price: nil
@type t :: %ChatInviteLink{
invite_link: binary,
creator: User.t(),
creates_join_request: boolean,
is_primary: boolean,
is_revoked: boolean,
name: binary,
expire_date: integer,
member_limit: integer,
pending_join_request_count: integer,
subscription_period: integer,
subscription_price: integer
}
end
defmodule PhotoSize do
defstruct file_id: nil, file_unique_id: nil, width: nil, height: nil, file_size: nil
@type t :: %PhotoSize{
file_id: binary,
file_unique_id: binary,
width: integer,
height: integer,
file_size: integer
}
end
defmodule Animation do
defstruct file_id: nil,
file_unique_id: nil,
width: nil,
height: nil,
duration: nil,
thumbnail: nil,
file_name: nil,
mime_type: nil,
file_size: nil
@type t :: %Animation{
file_id: binary,
file_unique_id: binary,
width: integer,
height: integer,
duration: integer,
thumbnail: PhotoSize.t(),
file_name: binary,
mime_type: binary,
file_size: integer
}
end
defmodule Audio do
defstruct file_id: nil,
file_unique_id: nil,
duration: nil,
performer: nil,
title: nil,
file_name: nil,
mime_type: nil,
file_size: nil,
thumbnail: nil
@type t :: %Audio{
file_id: binary,
file_unique_id: binary,
duration: integer,
performer: binary,
title: binary,
file_name: binary,
mime_type: binary,
file_size: integer,
thumbnail: PhotoSize.t()
}
end
defmodule Document do
defstruct file_id: nil,
file_unique_id: nil,
thumbnail: nil,
thumb: nil,
file_name: nil,
mime_type: nil,
file_size: nil
@type t :: %Document{
file_id: binary,
file_unique_id: binary,
thumbnail: PhotoSize.t(),
thumb: PhotoSize.t(),
file_name: binary,
mime_type: binary,
file_size: integer
}
end
defmodule Sticker do
defstruct file_id: nil,
file_unique_id: nil,
type: nil,
width: nil,
height: nil,
is_animated: nil,
is_video: nil,
thumbnail: nil,
thumb: nil,
emoji: nil,
set_name: nil,
premium_animation: nil,
mask_position: nil,
custom_emoji_id: nil,
needs_repainting: nil,
file_size: nil
@type t :: %Sticker{
file_id: binary,
file_unique_id: binary,
type: binary,
width: integer,
height: integer,
is_animated: boolean,
is_video: boolean,
thumbnail: PhotoSize.t(),
thumb: PhotoSize.t(),
emoji: binary,
set_name: binary,
premium_animation: Nadia.Model.File.t(),
mask_position: MaskPosition.t(),
custom_emoji_id: binary,
needs_repainting: boolean,
file_size: integer
}
end
defmodule StickerSet do
defstruct name: nil,
title: nil,
sticker_type: nil,
contains_masks: false,
stickers: [],
thumbnail: nil
@type t :: %StickerSet{
name: binary,
title: binary,
sticker_type: binary,
contains_masks: boolean,
stickers: [Sticker.t()],
thumbnail: PhotoSize.t()
}
end
defmodule GiftBackground do
defstruct center_color: nil, edge_color: nil, text_color: nil
@type t :: %GiftBackground{
center_color: integer,
edge_color: integer,
text_color: integer
}
end
defmodule Gift do
defstruct id: nil,
sticker: nil,
star_count: nil,
upgrade_star_count: nil,
is_premium: nil,
has_colors: nil,
total_count: nil,
remaining_count: nil,
personal_total_count: nil,
personal_remaining_count: nil,
background: nil,
unique_gift_variant_count: nil,
publisher_chat: nil
@type t :: %Gift{
id: binary,
sticker: Sticker.t(),
star_count: integer,
upgrade_star_count: integer,
is_premium: boolean,
has_colors: boolean,
total_count: integer,
remaining_count: integer,
personal_total_count: integer,
personal_remaining_count: integer,
background: GiftBackground.t(),
unique_gift_variant_count: integer,
publisher_chat: Chat.t()
}
end
defmodule Gifts do
defstruct gifts: []
@type t :: %Gifts{gifts: [Gift.t()]}
end
defmodule UniqueGiftModel do
defstruct name: nil, sticker: nil, rarity_per_mille: nil, rarity: nil
@type t :: %UniqueGiftModel{
name: binary,
sticker: Sticker.t(),
rarity_per_mille: integer,
rarity: binary
}
end
defmodule UniqueGiftSymbol do
defstruct name: nil, sticker: nil, rarity_per_mille: nil
@type t :: %UniqueGiftSymbol{
name: binary,
sticker: Sticker.t(),
rarity_per_mille: integer
}
end
defmodule UniqueGiftBackdropColors do
defstruct center_color: nil, edge_color: nil, symbol_color: nil, text_color: nil
@type t :: %UniqueGiftBackdropColors{
center_color: integer,
edge_color: integer,
symbol_color: integer,
text_color: integer
}
end
defmodule UniqueGiftBackdrop do
defstruct name: nil, colors: nil, rarity_per_mille: nil
@type t :: %UniqueGiftBackdrop{
name: binary,
colors: UniqueGiftBackdropColors.t(),
rarity_per_mille: integer
}
end
defmodule UniqueGiftColors do
defstruct model_custom_emoji_id: nil,
symbol_custom_emoji_id: nil,
light_theme_main_color: nil,
light_theme_other_colors: nil,
dark_theme_main_color: nil,
dark_theme_other_colors: nil
@type t :: %UniqueGiftColors{
model_custom_emoji_id: binary,
symbol_custom_emoji_id: binary,
light_theme_main_color: integer,
light_theme_other_colors: [integer],
dark_theme_main_color: integer,
dark_theme_other_colors: [integer]
}
end
defmodule UniqueGift do
defstruct gift_id: nil,
base_name: nil,
name: nil,
number: nil,
model: nil,
symbol: nil,
backdrop: nil,
is_premium: nil,
is_burned: nil,
is_from_blockchain: nil,
colors: nil,
publisher_chat: nil
@type t :: %UniqueGift{
gift_id: binary,
base_name: binary,
name: binary,
number: integer,
model: UniqueGiftModel.t(),
symbol: UniqueGiftSymbol.t(),
backdrop: UniqueGiftBackdrop.t(),
is_premium: boolean,
is_burned: boolean,
is_from_blockchain: boolean,
colors: UniqueGiftColors.t(),
publisher_chat: Chat.t()
}
end
defmodule OwnedGift do
defstruct type: nil
@type t :: %OwnedGift{type: binary} | OwnedGiftRegular.t() | OwnedGiftUnique.t()
end
defmodule OwnedGiftRegular do
defstruct type: nil,
gift: nil,
owned_gift_id: nil,
sender_user: nil,
send_date: nil,
text: nil,
entities: nil,
is_private: nil,
is_saved: nil,
can_be_upgraded: nil,
was_refunded: nil,
convert_star_count: nil,
prepaid_upgrade_star_count: nil,
is_upgrade_separate: nil,
unique_gift_number: nil
@type t :: %OwnedGiftRegular{
type: binary,
gift: Gift.t(),
owned_gift_id: binary,
sender_user: User.t(),
send_date: integer,
text: binary,
entities: [MessageEntity.t()],
is_private: boolean,
is_saved: boolean,
can_be_upgraded: boolean,
was_refunded: boolean,
convert_star_count: integer,
prepaid_upgrade_star_count: integer,
is_upgrade_separate: boolean,
unique_gift_number: integer
}
end
defmodule OwnedGiftUnique do
defstruct type: nil,
gift: nil,
owned_gift_id: nil,
sender_user: nil,
send_date: nil,
is_saved: nil,
can_be_transferred: nil,
transfer_star_count: nil,
next_transfer_date: nil
@type t :: %OwnedGiftUnique{
type: binary,
gift: UniqueGift.t(),
owned_gift_id: binary,
sender_user: User.t(),
send_date: integer,
is_saved: boolean,
can_be_transferred: boolean,
transfer_star_count: integer,
next_transfer_date: integer
}
end
defmodule OwnedGifts do
defstruct total_count: nil, gifts: [], next_offset: nil
@type t :: %OwnedGifts{
total_count: integer,
gifts: [OwnedGift.t()],
next_offset: binary
}
end
defmodule ForumTopic do
defstruct message_thread_id: nil,
name: nil,
icon_color: nil,
icon_custom_emoji_id: nil,
is_name_implicit: nil
@type t :: %ForumTopic{
message_thread_id: integer,
name: binary,
icon_color: integer,
icon_custom_emoji_id: binary,
is_name_implicit: boolean
}
end
defmodule MaskPosition do
defstruct point: nil, x_shift: nil, y_shift: nil, scale: nil
@type t :: %MaskPosition{
point: binary,
x_shift: float,
y_shift: float,
scale: float
}
end
defmodule LivePhoto do
defstruct photo: [],
file_id: nil,
file_unique_id: nil,
width: nil,
height: nil,
duration: nil,
mime_type: nil,
file_size: nil
@type t :: %LivePhoto{
photo: [PhotoSize.t()],
file_id: binary,
file_unique_id: binary,
width: integer,
height: integer,
duration: integer,
mime_type: binary,
file_size: integer
}
end
defmodule VideoQuality do
defstruct file_id: nil,
file_unique_id: nil,
width: nil,
height: nil,
codec: nil,
file_size: nil
@type t :: %VideoQuality{
file_id: binary,
file_unique_id: binary,
width: integer,
height: integer,
codec: binary,
file_size: integer
}
end
defmodule Video do
defstruct file_id: nil,
file_unique_id: nil,
width: nil,
height: nil,
duration: nil,
thumbnail: nil,
thumb: nil,
cover: [],
start_timestamp: nil,
qualities: [],
file_name: nil,
mime_type: nil,
file_size: nil
@type t :: %Video{
file_id: binary,
file_unique_id: binary,
width: integer,
height: integer,
duration: integer,
thumbnail: PhotoSize.t(),
thumb: PhotoSize.t(),
cover: [PhotoSize.t()],
start_timestamp: integer,
qualities: [VideoQuality.t()],
file_name: binary,
mime_type: binary,
file_size: integer
}
end
defmodule VideoNote do
defstruct file_id: nil,
file_unique_id: nil,
length: nil,
duration: nil,
thumbnail: nil,
file_size: nil
@type t :: %VideoNote{
file_id: binary,
file_unique_id: binary,
length: integer,
duration: integer,
thumbnail: PhotoSize.t(),
file_size: integer
}
end
defmodule Voice do
defstruct file_id: nil, file_unique_id: nil, duration: nil, mime_type: nil, file_size: nil
@type t :: %Voice{
file_id: binary,
file_unique_id: binary,
duration: integer,
mime_type: binary,
file_size: integer
}
end
defmodule Contact do
defstruct phone_number: nil, first_name: nil, last_name: nil, user_id: nil
@type t :: %Contact{
phone_number: binary,
first_name: binary,
last_name: binary,
user_id: integer
}
end
defmodule Location do
defstruct latitude: nil, longitude: nil
@type t :: %Location{latitude: float, longitude: float}
end
defmodule Venue do
defstruct location: nil, title: nil, address: nil, foursquare_id: nil
@type t :: %Venue{
location: Location.t(),
title: binary,
address: binary,
foursquare_id: binary
}
end
defmodule BusinessIntro do
defstruct title: nil, message: nil, sticker: nil
@type t :: %BusinessIntro{
title: binary,
message: binary,
sticker: Sticker.t()
}
end
defmodule BusinessLocation do
defstruct address: nil, location: nil
@type t :: %BusinessLocation{
address: binary,
location: Location.t()
}
end
defmodule BusinessOpeningHoursInterval do
defstruct opening_minute: nil, closing_minute: nil
@type t :: %BusinessOpeningHoursInterval{
opening_minute: integer,
closing_minute: integer
}
end
defmodule BusinessOpeningHours do
defstruct time_zone_name: nil, opening_hours: []
@type t :: %BusinessOpeningHours{
time_zone_name: binary,
opening_hours: [BusinessOpeningHoursInterval.t()]
}
end
defmodule ChecklistTask do
defstruct id: nil,
text: nil,
text_entities: nil,
completed_by_user: nil,
completed_by_chat: nil,
completion_date: nil
@type t :: %ChecklistTask{
id: integer,
text: binary,
text_entities: [MessageEntity.t()],
completed_by_user: User.t(),
completed_by_chat: Chat.t(),
completion_date: integer
}
end
defmodule Checklist do
defstruct title: nil,
title_entities: nil,
tasks: [],
others_can_add_tasks: nil,
others_can_mark_tasks_as_done: nil
@type t :: %Checklist{
title: binary,
title_entities: [MessageEntity.t()],
tasks: [ChecklistTask.t()],
others_can_add_tasks: boolean,
others_can_mark_tasks_as_done: boolean
}
end
defmodule RichMessage do
defstruct blocks: [], is_rtl: nil
@type t :: %RichMessage{
blocks: [any],
is_rtl: boolean
}
end
defmodule Message do
defstruct message_id: nil,
message_thread_id: nil,
from: nil,
sender_chat: nil,
sender_boost_count: nil,
sender_business_bot: nil,
sender_tag: nil,
date: nil,
guest_query_id: nil,
business_connection_id: nil,
chat: nil,
forward_from: nil,
forward_from_chat: nil,
forward_origin: nil,
forward_date: nil,
reply_to_message: nil,
external_reply: nil,
quote: nil,
reply_to_story: nil,
reply_to_checklist_task_id: nil,
reply_to_poll_option_id: nil,
via_bot: nil,
guest_bot_caller_user: nil,
guest_bot_caller_chat: nil,
edit_date: nil,
has_protected_content: nil,
is_topic_message: nil,
is_automatic_forward: nil,
is_from_offline: nil,
is_paid_post: nil,
media_group_id: nil,
author_signature: nil,
paid_star_count: nil,
text: nil,
entities: nil,
link_preview_options: nil,
suggested_post_info: nil,
effect_id: nil,
rich_message: nil,
animation: nil,
audio: nil,
document: nil,
live_photo: nil,
paid_media: nil,
photo: [],
story: nil,
sticker: nil,
video: nil,
video_note: nil,
voice: nil,
caption: nil,
caption_entities: nil,
show_caption_above_media: nil,
has_media_spoiler: nil,
checklist: nil,
contact: nil,
dice: nil,
game: nil,
poll: nil,
poll_option_added: nil,
poll_option_deleted: nil,
location: nil,
venue: nil,
boost_added: nil,
managed_bot_created: nil,
new_chat_member: nil,
new_chat_members: [],
left_chat_member: nil,
chat_owner_left: nil,
chat_owner_changed: nil,
new_chat_title: nil,
new_chat_photo: [],
delete_chat_photo: nil,
group_chat_created: nil,
supergroup_chat_created: nil,
channel_chat_created: nil,
migrate_to_chat_id: nil,
migrate_from_chat_id: nil,
pinned_message: nil,
reply_markup: nil,
web_app_data: nil
@type t :: %Message{
message_id: integer,
message_thread_id: integer,
from: User.t(),
sender_chat: Chat.t(),
sender_boost_count: integer,
sender_business_bot: User.t(),
sender_tag: binary,
date: integer,
guest_query_id: binary,
business_connection_id: binary,
chat: Chat.t(),
forward_from: User.t(),
forward_from_chat: Chat.t(),
forward_origin: any,
forward_date: integer,
reply_to_message: Message.t(),
external_reply: any,
quote: any,
reply_to_story: any,
reply_to_checklist_task_id: integer,
reply_to_poll_option_id: binary,
via_bot: User.t(),
guest_bot_caller_user: User.t(),
guest_bot_caller_chat: Chat.t(),
edit_date: integer,
has_protected_content: boolean,
is_topic_message: boolean,
is_automatic_forward: boolean,
is_from_offline: boolean,
is_paid_post: boolean,
media_group_id: binary,
author_signature: binary,
paid_star_count: integer,
text: binary,
entities: [MessageEntity.t()],
link_preview_options: any,
suggested_post_info: any,
effect_id: binary,
rich_message: RichMessage.t(),
animation: Animation.t(),
audio: Audio.t(),
document: Document.t(),
live_photo: LivePhoto.t(),
paid_media: PaidMediaInfo.t(),
photo: [PhotoSize.t()],
story: any,
sticker: Sticker.t(),
video: Video.t(),
video_note: VideoNote.t(),
voice: Voice.t(),
caption: binary,
caption_entities: [MessageEntity.t()],
show_caption_above_media: boolean,
has_media_spoiler: boolean,
checklist: Checklist.t(),
contact: any,
dice: any,
game: any,
poll: Poll.t(),
poll_option_added: PollOptionAdded.t(),
poll_option_deleted: PollOptionDeleted.t(),
location: any,
venue: any,
boost_added: ChatBoostAdded.t(),
managed_bot_created: ManagedBotCreated.t(),
new_chat_member: User.t(),
new_chat_members: [User.t()],
left_chat_member: User.t(),
chat_owner_left: any,
chat_owner_changed: any,
new_chat_title: binary,
new_chat_photo: [PhotoSize.t()],
delete_chat_photo: atom,
group_chat_created: atom,
supergroup_chat_created: atom,
channel_chat_created: atom,
migrate_to_chat_id: integer,
migrate_from_chat_id: integer,
pinned_message: Message.t(),
reply_markup: any,
web_app_data: any
}
end
defmodule MessageId do
defstruct message_id: nil
@type t :: %MessageId{message_id: integer}
end
defmodule PaidMediaInfo do
defstruct star_count: nil, paid_media: []
@type t :: %PaidMediaInfo{
star_count: integer,
paid_media: [PaidMedia.t()]
}
end
defmodule PaidMedia do
defstruct type: nil
@type t ::
%PaidMedia{type: binary}
| PaidMediaPhoto.t()
| PaidMediaPreview.t()
| PaidMediaVideo.t()
| PaidMediaLivePhoto.t()
end
defmodule PaidMediaPhoto do
defstruct type: nil, photo: []
@type t :: %PaidMediaPhoto{
type: binary,
photo: [PhotoSize.t()]
}
end
defmodule PaidMediaPreview do
defstruct type: nil, width: nil, height: nil, duration: nil
@type t :: %PaidMediaPreview{
type: binary,
width: integer,
height: integer,
duration: integer
}
end
defmodule PaidMediaVideo do
defstruct type: nil, video: nil
@type t :: %PaidMediaVideo{
type: binary,
video: Video.t()
}
end
defmodule PaidMediaLivePhoto do
defstruct type: nil, live_photo: nil
@type t :: %PaidMediaLivePhoto{
type: binary,
live_photo: any
}
end
defmodule PaidMediaPurchased do
defstruct from: nil, paid_media_payload: nil
@type t :: %PaidMediaPurchased{
from: User.t(),
paid_media_payload: binary
}
end
defmodule BusinessBotRights do
defstruct can_reply: nil,
can_read_messages: nil,
can_delete_sent_messages: nil,
can_delete_all_messages: nil,
can_edit_name: nil,
can_edit_bio: nil,
can_edit_profile_photo: nil,
can_edit_username: nil,
can_change_gift_settings: nil,
can_view_gifts_and_stars: nil,
can_convert_gifts_to_stars: nil,
can_transfer_and_upgrade_gifts: nil,
can_transfer_stars: nil,
can_manage_stories: nil
@type t :: %BusinessBotRights{
can_reply: boolean,
can_read_messages: boolean,
can_delete_sent_messages: boolean,
can_delete_all_messages: boolean,
can_edit_name: boolean,
can_edit_bio: boolean,
can_edit_profile_photo: boolean,
can_edit_username: boolean,
can_change_gift_settings: boolean,
can_view_gifts_and_stars: boolean,
can_convert_gifts_to_stars: boolean,
can_transfer_and_upgrade_gifts: boolean,
can_transfer_stars: boolean,
can_manage_stories: boolean
}
end
defmodule BusinessConnection do
defstruct id: nil,
user: nil,
user_chat_id: nil,
date: nil,
rights: nil,
is_enabled: nil
@type t :: %BusinessConnection{
id: binary,
user: User.t(),
user_chat_id: integer,
date: integer,
rights: BusinessBotRights.t(),
is_enabled: boolean
}
end
defmodule BusinessMessagesDeleted do
defstruct business_connection_id: nil, chat: nil, message_ids: []
@type t :: %BusinessMessagesDeleted{
business_connection_id: binary,
chat: Chat.t(),
message_ids: [integer]
}
end
defmodule SentGuestMessage do
defstruct inline_message_id: nil
@type t :: %SentGuestMessage{
inline_message_id: binary
}
end
defmodule SentWebAppMessage do
defstruct inline_message_id: nil
@type t :: %SentWebAppMessage{
inline_message_id: binary
}
end
defmodule PreparedInlineMessage do
defstruct id: nil, expiration_date: nil
@type t :: %PreparedInlineMessage{
id: binary,
expiration_date: integer
}
end
defmodule PreparedKeyboardButton do
defstruct id: nil
@type t :: %PreparedKeyboardButton{
id: binary
}
end
defmodule ManagedBotCreated do
defstruct bot: nil
@type t :: %ManagedBotCreated{
bot: User.t()
}
end
defmodule ManagedBotUpdated do
defstruct user: nil, bot: nil
@type t :: %ManagedBotUpdated{
user: User.t(),
bot: User.t()
}
end
defmodule BotAccessSettings do
defstruct is_access_restricted: nil, added_users: []
@type t :: %BotAccessSettings{
is_access_restricted: boolean,
added_users: [User.t()]
}
end
defmodule ChatBoostSource do
defstruct source: nil
@type t ::
%ChatBoostSource{source: binary}
| ChatBoostSourcePremium.t()
| ChatBoostSourceGiftCode.t()
| ChatBoostSourceGiveaway.t()
end
defmodule ChatBoostSourcePremium do
defstruct source: nil, user: nil
@type t :: %ChatBoostSourcePremium{
source: binary,
user: User.t()
}
end
defmodule ChatBoostSourceGiftCode do
defstruct source: nil, user: nil
@type t :: %ChatBoostSourceGiftCode{
source: binary,
user: User.t()
}
end
defmodule ChatBoostSourceGiveaway do
defstruct source: nil,
giveaway_message_id: nil,
user: nil,
prize_star_count: nil,
is_unclaimed: nil
@type t :: %ChatBoostSourceGiveaway{
source: binary,
giveaway_message_id: integer,
user: User.t(),
prize_star_count: integer,
is_unclaimed: boolean
}
end
defmodule ChatBoost do
defstruct boost_id: nil, add_date: nil, expiration_date: nil, source: nil
@type t :: %ChatBoost{
boost_id: binary,
add_date: integer,
expiration_date: integer,
source: ChatBoostSource.t()
}
end
defmodule ChatBoostUpdated do
defstruct chat: nil, boost: nil
@type t :: %ChatBoostUpdated{
chat: Chat.t(),
boost: ChatBoost.t()
}
end
defmodule ChatBoostRemoved do
defstruct chat: nil, boost_id: nil, remove_date: nil, source: nil
@type t :: %ChatBoostRemoved{
chat: Chat.t(),
boost_id: binary,
remove_date: integer,
source: ChatBoostSource.t()
}
end
defmodule UserChatBoosts do
defstruct boosts: []
@type t :: %UserChatBoosts{
boosts: [ChatBoost.t()]
}
end
defmodule GameHighScore do
defstruct position: nil, user: nil, score: nil
@type t :: %GameHighScore{
position: integer,
user: User.t(),
score: integer
}
end
defmodule ChatBoostAdded do
defstruct boost_count: nil
@type t :: %ChatBoostAdded{
boost_count: integer
}
end
defmodule MessageEntity do
defstruct type: nil,
offset: nil,
length: nil,
url: nil,
user: nil,
language: nil,
custom_emoji_id: nil,
unix_time: nil,
date_time_format: nil
@type t :: %MessageEntity{
type: binary,
offset: integer,
length: integer,
url: binary,
user: User.t(),
language: binary,
custom_emoji_id: binary,
unix_time: integer,
date_time_format: binary
}
end
defmodule ReactionType do
defstruct type: nil, emoji: nil, custom_emoji_id: nil
@type t :: %ReactionType{
type: binary,
emoji: binary,
custom_emoji_id: binary
}
end
defmodule ReactionCount do
defstruct type: nil, total_count: nil
@type t :: %ReactionCount{
type: ReactionType.t(),
total_count: integer
}
end
defmodule MessageReactionUpdated do
defstruct chat: nil,
message_id: nil,
user: nil,
actor_chat: nil,
date: nil,
old_reaction: [],
new_reaction: []
@type t :: %MessageReactionUpdated{
chat: Chat.t(),
message_id: integer,
user: User.t(),
actor_chat: Chat.t(),
date: integer,
old_reaction: [ReactionType.t()],
new_reaction: [ReactionType.t()]
}
end
defmodule MessageReactionCountUpdated do
defstruct chat: nil, message_id: nil, date: nil, reactions: []
@type t :: %MessageReactionCountUpdated{
chat: Chat.t(),
message_id: integer,
date: integer,
reactions: [ReactionCount.t()]
}
end
defmodule PollMedia do
defstruct animation: nil,
audio: nil,
document: nil,
link: nil,
live_photo: nil,
location: nil,
photo: [],
sticker: nil,
venue: nil,
video: nil
@type t :: %PollMedia{
animation: any,
audio: Audio.t(),
document: Document.t(),
link: Link.t(),
live_photo: any,
location: Location.t(),
photo: [PhotoSize.t()],
sticker: Sticker.t(),
venue: Venue.t(),
video: Video.t()
}
end
defmodule Link do
defstruct url: nil
@type t :: %Link{url: binary}
end
defmodule PollOption do
defstruct persistent_id: nil,
text: nil,
text_entities: nil,
media: nil,
voter_count: nil,
added_by_user: nil,
added_by_chat: nil,
addition_date: nil
@type t :: %PollOption{
persistent_id: binary,
text: binary,
text_entities: [MessageEntity.t()],
media: PollMedia.t(),
voter_count: integer,
added_by_user: User.t(),
added_by_chat: Chat.t(),
addition_date: integer
}
end
defmodule PollAnswer do
defstruct poll_id: nil,
voter_chat: nil,
user: nil,
option_ids: [],
option_persistent_ids: []
@type t :: %PollAnswer{
poll_id: binary,
voter_chat: Chat.t(),
user: User.t(),
option_ids: [integer],
option_persistent_ids: [binary]
}
end
defmodule Poll do
defstruct id: nil,
question: nil,
question_entities: nil,
options: [],
total_voter_count: nil,
is_closed: nil,
is_anonymous: nil,
type: nil,
allows_multiple_answers: nil,
allows_revoting: nil,
members_only: nil,
country_codes: nil,
correct_option_ids: nil,
explanation: nil,
explanation_entities: nil,
explanation_media: nil,
open_period: nil,
close_date: nil,
description: nil,
description_entities: nil,
media: nil
@type t :: %Poll{
id: binary,
question: binary,
question_entities: [MessageEntity.t()],
options: [PollOption.t()],
total_voter_count: integer,
is_closed: boolean,
is_anonymous: boolean,
type: binary,
allows_multiple_answers: boolean,
allows_revoting: boolean,
members_only: boolean,
country_codes: [binary],
correct_option_ids: [integer],
explanation: binary,
explanation_entities: [MessageEntity.t()],
explanation_media: PollMedia.t(),
open_period: integer,
close_date: integer,
description: binary,
description_entities: [MessageEntity.t()],
media: PollMedia.t()
}
end
defmodule PollOptionAdded do
defstruct poll_message: nil,
option_persistent_id: nil,
option_text: nil,
option_text_entities: nil
@type t :: %PollOptionAdded{
poll_message: Message.t(),
option_persistent_id: binary,
option_text: binary,
option_text_entities: [MessageEntity.t()]
}
end
defmodule PollOptionDeleted do
defstruct poll_message: nil,
option_persistent_id: nil,
option_text: nil,
option_text_entities: nil
@type t :: %PollOptionDeleted{
poll_message: Message.t(),
option_persistent_id: binary,
option_text: binary,
option_text_entities: [MessageEntity.t()]
}
end
defmodule InlineQuery do
defstruct id: nil, from: nil, location: nil, query: nil, offset: nil
@type t :: %InlineQuery{
id: binary,
from: User.t(),
location: Location.t(),
query: binary,
offset: integer
}
end
defmodule ChosenInlineResult do
defstruct result_id: nil, from: nil, location: nil, inline_message_id: nil, query: nil
@type t :: %ChosenInlineResult{
result_id: binary,
from: User.t(),
location: Location.t(),
inline_message_id: binary,
query: binary
}
end
defmodule ChatJoinRequest do
defstruct chat: nil,
from: nil,
user_chat_id: nil,
date: nil,
bio: nil,
invite_link: nil,
query_id: nil
@type t :: %ChatJoinRequest{
chat: Chat.t(),
from: User.t(),
user_chat_id: integer,
date: integer,
bio: binary,
invite_link: ChatInviteLink.t(),
query_id: binary
}
end
defmodule Update do
defstruct update_id: nil,
message: nil,
edited_message: nil,
channel_post: nil,
edited_channel_post: nil,
business_connection: nil,
business_message: nil,
edited_business_message: nil,
deleted_business_messages: nil,
guest_message: nil,
message_reaction: nil,
message_reaction_count: nil,
inline_query: nil,
chosen_inline_result: nil,
callback_query: nil,
shipping_query: nil,
pre_checkout_query: nil,
purchased_paid_media: nil,
poll: nil,
poll_answer: nil,
my_chat_member: nil,
chat_member: nil,
chat_join_request: nil,
chat_boost: nil,
removed_chat_boost: nil,
managed_bot: nil
@type t :: %Update{
update_id: integer,
message: Message.t(),
edited_message: Message.t(),
channel_post: Message.t(),
edited_channel_post: Message.t(),
business_connection: BusinessConnection.t(),
business_message: Message.t(),
edited_business_message: Message.t(),
deleted_business_messages: BusinessMessagesDeleted.t(),
guest_message: Message.t(),
message_reaction: MessageReactionUpdated.t(),
message_reaction_count: MessageReactionCountUpdated.t(),
inline_query: InlineQuery.t(),
chosen_inline_result: ChosenInlineResult.t(),
callback_query: CallbackQuery.t(),
shipping_query: any,
pre_checkout_query: any,
purchased_paid_media: PaidMediaPurchased.t(),
poll: Poll.t(),
poll_answer: PollAnswer.t(),
my_chat_member: any,
chat_member: any,
chat_join_request: ChatJoinRequest.t(),
chat_boost: ChatBoostUpdated.t(),
removed_chat_boost: ChatBoostRemoved.t(),
managed_bot: ManagedBotUpdated.t()
}
end
defmodule UserProfilePhotos do
defstruct total_count: nil, photos: []
@type t :: %UserProfilePhotos{total_count: integer, photos: [[PhotoSize.t()]]}
end
defmodule UserProfileAudios do
defstruct total_count: nil, audios: []
@type t :: %UserProfileAudios{total_count: integer, audios: [Audio.t()]}
end
defmodule File do
defstruct file_id: nil, file_unique_id: nil, file_size: nil, file_path: nil
@type t :: %File{
file_id: binary,
file_unique_id: binary,
file_size: non_neg_integer | nil,
file_path: binary | nil
}
end
defmodule ReplyKeyboardMarkup do
@derive Jason.Encoder
defstruct keyboard: [], resize_keyboard: false, one_time_keyboard: false, selective: false
@type t :: %ReplyKeyboardMarkup{
keyboard: [[KeyboardButton.t()]],
resize_keyboard: atom,
one_time_keyboard: atom,
selective: atom
}
end
defmodule KeyboardButton do
@derive Jason.Encoder
defstruct text: nil, request_contact: false, request_location: false
@type t :: %KeyboardButton{text: binary, request_contact: atom, request_location: atom}
end
defmodule ReplyKeyboardRemove do
@derive Jason.Encoder
defstruct remove_keyboard: true, selective: false
@type t :: %ReplyKeyboardRemove{remove_keyboard: true, selective: atom}
end
defmodule InlineKeyboardMarkup do
@derive Jason.Encoder
defstruct inline_keyboard: []
@type t :: %InlineKeyboardMarkup{inline_keyboard: [[InlineKeyboardButton.t()]]}
end
defmodule InlineKeyboardButton do
defstruct text: nil,
url: nil,
callback_data: nil,
switch_inline_query: nil,
switch_inline_query_current_chat: nil
@type t :: %InlineKeyboardButton{
text: binary,
url: binary,
callback_data: binary,
switch_inline_query: binary,
switch_inline_query_current_chat: binary
}
end
defmodule CallbackQuery do
defstruct id: nil, from: nil, message: nil, inline_message_id: nil, data: nil
@type t :: %CallbackQuery{
id: binary,
from: User.t(),
message: Message.t(),
inline_message_id: binary,
data: binary
}
end
defmodule ForceReply do
@derive Jason.Encoder
defstruct force_reply: true, selective: false
@type t :: %ForceReply{force_reply: true, selective: atom}
end
defmodule ChatMember do
defstruct user: nil, status: nil
@type t :: %ChatMember{user: User.t(), status: binary}
end
defmodule WebhookInfo do
defstruct url: nil,
has_custom_certificate: nil,
pending_update_count: nil,
last_error_date: nil,
last_error_message: nil,
max_connections: nil,
allowed_updates: []
@type t :: %WebhookInfo{
url: binary,
has_custom_certificate: boolean,
pending_update_count: non_neg_integer,
last_error_date: non_neg_integer,
last_error_message: binary,
max_connections: non_neg_integer,
allowed_updates: [binary]
}
end
defmodule ResponseParameters do
@moduledoc """
Details supplied by Telegram for automatically handling selected errors.
See the official Bot API `ResponseParameters` object for the semantics of
chat migration and flood-control delays.
"""
defstruct migrate_to_chat_id: nil, retry_after: nil
@type t :: %ResponseParameters{
migrate_to_chat_id: integer | nil,
retry_after: non_neg_integer | nil
}
end
defmodule Error do
defexception reason: nil, error_code: nil, parameters: nil
@type t :: %Error{
reason: any,
error_code: integer | nil,
parameters: ResponseParameters.t() | nil
}
def message(%Error{reason: reason}), do: inspect(reason)
end
end