diff options
| author | 2024-07-20 17:22:25 +0300 | |
|---|---|---|
| committer | 2024-07-20 17:22:25 +0300 | |
| commit | c70ffd095a6de5cd5b872796a0d82a8c5afc1511 (patch) | |
| tree | 56183274b05a294e357bad4d06b523472a1c4a4a /src/types | |
| download | ukkobot-c70ffd095a6de5cd5b872796a0d82a8c5afc1511.tar.gz ukkobot-c70ffd095a6de5cd5b872796a0d82a8c5afc1511.tar.xz ukkobot-c70ffd095a6de5cd5b872796a0d82a8c5afc1511.zip | |
Initial commit
Diffstat (limited to 'src/types')
98 files changed, 1093 insertions, 0 deletions
diff --git a/src/types/Animation.zig b/src/types/Animation.zig new file mode 100644 index 0000000..f5d6efc --- /dev/null +++ b/src/types/Animation.zig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | file_id: []const u8, | ||
| 4 | file_unique_id: []const u8, | ||
| 5 | width: u64, | ||
| 6 | height: u64, | ||
| 7 | duration: u64, | ||
| 8 | thumbnail: ?[]PhotoSize = null, | ||
| 9 | file_name: ?[]const u8 = null, | ||
| 10 | mime_type: ?[]const u8 = null, | ||
| 11 | file_size: ?u64 = null, | ||
diff --git a/src/types/Audio.zig b/src/types/Audio.zig new file mode 100644 index 0000000..1914088 --- /dev/null +++ b/src/types/Audio.zig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | file_id: []const u8, | ||
| 4 | file_unique_id: []const u8, | ||
| 5 | duration: u64, | ||
| 6 | performer: ?[]const u8 = null, | ||
| 7 | title: ?[]const u8 = null, | ||
| 8 | file_name: ?[]const u8 = null, | ||
| 9 | mime_type: ?[]const u8 = null, | ||
| 10 | file_size: ?u64 = null, | ||
| 11 | thumbnail: ?PhotoSize = null, | ||
diff --git a/src/types/BotName.zig b/src/types/BotName.zig new file mode 100644 index 0000000..61a2cb6 --- /dev/null +++ b/src/types/BotName.zig | |||
| @@ -0,0 +1 @@ | |||
| name: []const u8, | |||
diff --git a/src/types/BusinessConnection.zig b/src/types/BusinessConnection.zig new file mode 100644 index 0000000..0801235 --- /dev/null +++ b/src/types/BusinessConnection.zig | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | const User = @import("User.zig"); | ||
| 2 | |||
| 3 | id: []const u8, | ||
| 4 | user: User, | ||
| 5 | user_chat_id: i64, | ||
| 6 | date: u64, | ||
| 7 | can_reply: bool, | ||
| 8 | is_enabled: bool, | ||
diff --git a/src/types/BusinessMessagesDeleted.zig b/src/types/BusinessMessagesDeleted.zig new file mode 100644 index 0000000..ef55793 --- /dev/null +++ b/src/types/BusinessMessagesDeleted.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | |||
| 3 | business_connection_id: []const u8, | ||
| 4 | chat: Chat, | ||
| 5 | message_ids: []u64, | ||
diff --git a/src/types/CallbackGame.zig b/src/types/CallbackGame.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/CallbackGame.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/CallbackQuery.zig b/src/types/CallbackQuery.zig new file mode 100644 index 0000000..8fb96c3 --- /dev/null +++ b/src/types/CallbackQuery.zig | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | const MaybeInaccessibleMessage = @import("Message.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | id: []const u8, | ||
| 5 | from: User, | ||
| 6 | message: ?MaybeInaccessibleMessage = null, | ||
| 7 | inline_message_id: ?[]const u8 = null, | ||
| 8 | chat_instance: []const u8, | ||
| 9 | data: ?[]const u8 = null, | ||
| 10 | game_short_name: ?[]const u8 = null, | ||
diff --git a/src/types/Chat.zig b/src/types/Chat.zig new file mode 100644 index 0000000..f44e480 --- /dev/null +++ b/src/types/Chat.zig | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | pub const Type = enum { | ||
| 2 | private, | ||
| 3 | group, | ||
| 4 | supergroup, | ||
| 5 | channel, | ||
| 6 | }; | ||
| 7 | |||
| 8 | id: i64, | ||
| 9 | type: Type, | ||
| 10 | title: ?[]const u8 = null, | ||
| 11 | username: ?[]const u8 = null, | ||
| 12 | first_name: ?[]const u8 = null, | ||
| 13 | last_name: ?[]const u8 = null, | ||
| 14 | is_forum: bool = false, | ||
diff --git a/src/types/ChatBackground.zig b/src/types/ChatBackground.zig new file mode 100644 index 0000000..34d2e15 --- /dev/null +++ b/src/types/ChatBackground.zig | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | const BackgroundType = @import("background_type.zig").BackgroundType; | ||
| 2 | |||
| 3 | type: BackgroundType, | ||
diff --git a/src/types/ChatBoost.zig b/src/types/ChatBoost.zig new file mode 100644 index 0000000..353805b --- /dev/null +++ b/src/types/ChatBoost.zig | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | const ChatBoostSource = @import("chat_boost_source.zig").ChatBoostSource; | ||
| 2 | |||
| 3 | boost_id: []const u8, | ||
| 4 | add_date: u64, | ||
| 5 | expiration_date: u64, | ||
| 6 | source: ChatBoostSource, | ||
diff --git a/src/types/ChatBoostAdded.zig b/src/types/ChatBoostAdded.zig new file mode 100644 index 0000000..487ae70 --- /dev/null +++ b/src/types/ChatBoostAdded.zig | |||
| @@ -0,0 +1 @@ | |||
| boost_count: u64, | |||
diff --git a/src/types/ChatBoostRemoved.zig b/src/types/ChatBoostRemoved.zig new file mode 100644 index 0000000..0d61bc5 --- /dev/null +++ b/src/types/ChatBoostRemoved.zig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const ChatBoostSource = @import("chat_boost_source.zig").ChatBoostSource; | ||
| 3 | |||
| 4 | chat: Chat, | ||
| 5 | boost_id: []const u8, | ||
| 6 | remove_date: u64, | ||
| 7 | source: ChatBoostSource, | ||
diff --git a/src/types/ChatBoostUpdated.zig b/src/types/ChatBoostUpdated.zig new file mode 100644 index 0000000..e7ad33c --- /dev/null +++ b/src/types/ChatBoostUpdated.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const ChatBoost = @import("ChatBoost.zig"); | ||
| 3 | |||
| 4 | chat: Chat, | ||
| 5 | boost: ChatBoost, | ||
diff --git a/src/types/ChatInviteLink.zig b/src/types/ChatInviteLink.zig new file mode 100644 index 0000000..41a1f44 --- /dev/null +++ b/src/types/ChatInviteLink.zig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | const User = @import("User.zig"); | ||
| 2 | |||
| 3 | invite_link: []const u8, | ||
| 4 | creator: User, | ||
| 5 | creates_join_request: bool, | ||
| 6 | is_primary: bool, | ||
| 7 | is_revoked: bool, | ||
| 8 | name: ?[]const u8, | ||
| 9 | expire_date: ?u64, | ||
| 10 | member_limit: ?u64, | ||
| 11 | pending_join_request_count: ?u64, | ||
diff --git a/src/types/ChatJoinRequest.zig b/src/types/ChatJoinRequest.zig new file mode 100644 index 0000000..f08e070 --- /dev/null +++ b/src/types/ChatJoinRequest.zig | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const ChatInviteLink = @import("ChatInviteLink.zig"); | ||
| 3 | const User = @import("User.zig"); | ||
| 4 | |||
| 5 | chat: Chat, | ||
| 6 | from: User, | ||
| 7 | user_chat_id: i64, | ||
| 8 | date: u64, | ||
| 9 | bio: ?[]const u8, | ||
| 10 | invite_link: ?ChatInviteLink, | ||
diff --git a/src/types/ChatMemberUpdated.zig b/src/types/ChatMemberUpdated.zig new file mode 100644 index 0000000..8df56ec --- /dev/null +++ b/src/types/ChatMemberUpdated.zig | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const ChatInviteLink = @import("ChatInviteLink.zig"); | ||
| 3 | const ChatMember = @import("chat_member.zig").ChatMember; | ||
| 4 | const User = @import("User.zig"); | ||
| 5 | |||
| 6 | chat: Chat, | ||
| 7 | from: User, | ||
| 8 | date: u64, | ||
| 9 | old_chat_member: ChatMember, | ||
| 10 | new_chat_member: ChatMember, | ||
| 11 | invite_link: ?ChatInviteLink = null, | ||
| 12 | via_join_request: bool = false, | ||
| 13 | via_chat_folder_invite_link: bool = false, | ||
diff --git a/src/types/ChatShared.zig b/src/types/ChatShared.zig new file mode 100644 index 0000000..7b49f02 --- /dev/null +++ b/src/types/ChatShared.zig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | request_id: u64, | ||
| 4 | chat_id: i64, | ||
| 5 | title: ?[]const u8 = null, | ||
| 6 | username: ?[]const u8 = null, | ||
| 7 | photo: ?[]PhotoSize = null, | ||
diff --git a/src/types/ChosenInlineResult.zig b/src/types/ChosenInlineResult.zig new file mode 100644 index 0000000..e0528cd --- /dev/null +++ b/src/types/ChosenInlineResult.zig | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | const Location = @import("Location.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | result_id: []const u8, | ||
| 5 | from: User, | ||
| 6 | location: ?Location = null, | ||
| 7 | inline_message_id: ?[]const u8, | ||
| 8 | query: []const u8, | ||
diff --git a/src/types/Contact.zig b/src/types/Contact.zig new file mode 100644 index 0000000..e3000fa --- /dev/null +++ b/src/types/Contact.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | phone_number: []const u8, | ||
| 2 | first_name: []const u8, | ||
| 3 | last_name: ?[]const u8 = null, | ||
| 4 | user_id: ?[]u64 = null, | ||
| 5 | vcard: ?[]const u8 = null, | ||
diff --git a/src/types/Dice.zig b/src/types/Dice.zig new file mode 100644 index 0000000..9aa6b06 --- /dev/null +++ b/src/types/Dice.zig | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | emoji: []const u8, | ||
| 2 | value: u8, | ||
diff --git a/src/types/Document.zig b/src/types/Document.zig new file mode 100644 index 0000000..811273d --- /dev/null +++ b/src/types/Document.zig | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | file_id: []const u8, | ||
| 4 | file_unique_id: []const u8, | ||
| 5 | thumbnail: ?PhotoSize = null, | ||
| 6 | file_name: ?[]const u8, | ||
| 7 | mime_type: ?[]const u8, | ||
| 8 | file_size: ?u64 = null, | ||
diff --git a/src/types/EditMessageTextParams.zig b/src/types/EditMessageTextParams.zig new file mode 100644 index 0000000..3e7701f --- /dev/null +++ b/src/types/EditMessageTextParams.zig | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | const InlineKeyboardMarkup = @import("InlineKeyboardMarkup.zig"); | ||
| 2 | const LinkPreviewOptions = @import("LinkPreviewOptions.zig"); | ||
| 3 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 4 | const ParseMode = @import("parse_mode.zig").ParseMode; | ||
| 5 | |||
| 6 | business_connection_id: ?[]const u8 = null, | ||
| 7 | // TODO: Integer or String | ||
| 8 | chat_id: i64, | ||
| 9 | message_id: u64, | ||
| 10 | // TODO: Make a different call for this bcs it returns just true :D | ||
| 11 | // inline_message_id: ?u64 = null, | ||
| 12 | text: []const u8, | ||
| 13 | parse_mode: ?ParseMode = null, | ||
| 14 | entities: ?[]MessageEntity = null, | ||
| 15 | link_preview_options: ?LinkPreviewOptions = null, | ||
| 16 | reply_markup: ?InlineKeyboardMarkup = null, | ||
diff --git a/src/types/EncryptedCredentials.zig b/src/types/EncryptedCredentials.zig new file mode 100644 index 0000000..6c87689 --- /dev/null +++ b/src/types/EncryptedCredentials.zig | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | data: []const u8, | ||
| 2 | hash: []const u8, | ||
| 3 | secret: []const u8, | ||
diff --git a/src/types/EncryptedPassportElement.zig b/src/types/EncryptedPassportElement.zig new file mode 100644 index 0000000..ca0e2ed --- /dev/null +++ b/src/types/EncryptedPassportElement.zig | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | // TODO: Turn this into a tagged union | ||
| 2 | |||
| 3 | const PassportFile = @import("PassportFile.zig"); | ||
| 4 | |||
| 5 | pub const Type = enum { | ||
| 6 | personal_details, | ||
| 7 | passport, | ||
| 8 | driver_license, | ||
| 9 | identity_card, | ||
| 10 | internal_passport, | ||
| 11 | address, | ||
| 12 | utility_bill, | ||
| 13 | bank_statement, | ||
| 14 | rental_agreement, | ||
| 15 | passport_registration, | ||
| 16 | temporary_registration, | ||
| 17 | phone_number, | ||
| 18 | email, | ||
| 19 | }; | ||
| 20 | |||
| 21 | type: Type, | ||
| 22 | data: ?[]const u8, | ||
| 23 | phone_number: ?[]const u8, | ||
| 24 | email: ?[]const u8, | ||
| 25 | files: ?[]PassportFile, | ||
| 26 | front_side: ?PassportFile, | ||
| 27 | reverse_side: ?PassportFile, | ||
| 28 | selfie: ?PassportFile, | ||
| 29 | translation: ?[]PassportFile, | ||
| 30 | hash: []const u8, | ||
diff --git a/src/types/ExternalReplyInfo.zig b/src/types/ExternalReplyInfo.zig new file mode 100644 index 0000000..89aa004 --- /dev/null +++ b/src/types/ExternalReplyInfo.zig | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | const Animation = @import("Animation.zig"); | ||
| 2 | const Audio = @import("Audio.zig"); | ||
| 3 | const Chat = @import("Chat.zig"); | ||
| 4 | const Contact = @import("Contact.zig"); | ||
| 5 | const Dice = @import("Dice.zig"); | ||
| 6 | const Document = @import("Document.zig"); | ||
| 7 | const Game = @import("Game.zig"); | ||
| 8 | const Giveaway = @import("Giveaway.zig"); | ||
| 9 | const GiveawayWinners = @import("GiveawayWinners.zig"); | ||
| 10 | const Invoice = @import("Invoice.zig"); | ||
| 11 | const LinkPreviewOptions = @import("LinkPreviewOptions.zig"); | ||
| 12 | const Location = @import("Location.zig"); | ||
| 13 | const MessageOrigin = @import("message_origin.zig").MessageOrigin; | ||
| 14 | const PaidMediaInfo = @import("PaidMediaInfo.zig"); | ||
| 15 | const Poll = @import("Poll.zig"); | ||
| 16 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 17 | const Sticker = @import("Sticker.zig"); | ||
| 18 | const Story = @import("Story.zig"); | ||
| 19 | const Venue = @import("Venue.zig"); | ||
| 20 | const Video = @import("Video.zig"); | ||
| 21 | const VideoNote = @import("VideoNote.zig"); | ||
| 22 | const Voice = @import("Voice.zig"); | ||
| 23 | |||
| 24 | origin: MessageOrigin, | ||
| 25 | chat: ?Chat = null, | ||
| 26 | message_id: ?u64 = null, | ||
| 27 | link_preview_options: ?LinkPreviewOptions = null, | ||
| 28 | animation: ?Animation = null, | ||
| 29 | audio: ?Audio = null, | ||
| 30 | document: ?Document = null, | ||
| 31 | paid_media: ?PaidMediaInfo = null, | ||
| 32 | photo: ?[]PhotoSize = null, | ||
| 33 | sticker: ?Sticker = null, | ||
| 34 | story: ?Story = null, | ||
| 35 | video: ?Video = null, | ||
| 36 | video_note: ?VideoNote = null, | ||
| 37 | voice: ?Voice = null, | ||
| 38 | has_media_spoiler: bool = false, | ||
| 39 | contact: ?Contact = null, | ||
| 40 | dice: ?Dice = null, | ||
| 41 | game: ?Game = null, | ||
| 42 | giveaway: ?Giveaway = null, | ||
| 43 | giveaway_winners: ?GiveawayWinners = null, | ||
| 44 | invoice: ?Invoice = null, | ||
| 45 | location: ?Location = null, | ||
| 46 | poll: ?Poll = null, | ||
| 47 | venue: ?Venue = null, | ||
diff --git a/src/types/File.zig b/src/types/File.zig new file mode 100644 index 0000000..3555bc9 --- /dev/null +++ b/src/types/File.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | file_id: []const u8, | ||
| 2 | file_unique_id: []const u8, | ||
| 3 | file_size: ?u64 = null, | ||
| 4 | file_path: ?[]const u8 = null, | ||
diff --git a/src/types/ForumTopicClosed.zig b/src/types/ForumTopicClosed.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/ForumTopicClosed.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/ForumTopicCreated.zig b/src/types/ForumTopicCreated.zig new file mode 100644 index 0000000..2429de7 --- /dev/null +++ b/src/types/ForumTopicCreated.zig | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | name: []const u8, | ||
| 2 | icon_color: u24, | ||
| 3 | icon_custom_emoji_id: ?[]const u8 = null, | ||
diff --git a/src/types/ForumTopicEdited.zig b/src/types/ForumTopicEdited.zig new file mode 100644 index 0000000..097acb3 --- /dev/null +++ b/src/types/ForumTopicEdited.zig | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | name: ?[]const u8 = null, | ||
| 2 | icon_custom_emoji_id: ?[]const u8 = null, | ||
diff --git a/src/types/ForumTopicReopened.zig b/src/types/ForumTopicReopened.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/ForumTopicReopened.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/Game.zig b/src/types/Game.zig new file mode 100644 index 0000000..3738284 --- /dev/null +++ b/src/types/Game.zig | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | const Animation = @import("Animation.zig"); | ||
| 2 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 3 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 4 | |||
| 5 | title: []const u8, | ||
| 6 | description: []const u8, | ||
| 7 | photo: []PhotoSize, | ||
| 8 | text: ?[]const u8 = null, | ||
| 9 | text_entities: ?[]MessageEntity = null, | ||
| 10 | animation: ?Animation = null, | ||
diff --git a/src/types/GeneralForumTopicHidden.zig b/src/types/GeneralForumTopicHidden.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/GeneralForumTopicHidden.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/GeneralForumTopicUnhidden.zig b/src/types/GeneralForumTopicUnhidden.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/GeneralForumTopicUnhidden.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/GetMyNameParams.zig b/src/types/GetMyNameParams.zig new file mode 100644 index 0000000..2cb38fa --- /dev/null +++ b/src/types/GetMyNameParams.zig | |||
| @@ -0,0 +1 @@ | |||
| language_code: ?[]const u8 = null | |||
diff --git a/src/types/GetUpdatesParams.zig b/src/types/GetUpdatesParams.zig new file mode 100644 index 0000000..0a4e333 --- /dev/null +++ b/src/types/GetUpdatesParams.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | offset: ?u64 = null, | ||
| 2 | limit: ?u64 = null, | ||
| 3 | timeout: ?u64 = null, | ||
| 4 | allowed_updates: ?[]const u8 = null, | ||
diff --git a/src/types/Giveaway.zig b/src/types/Giveaway.zig new file mode 100644 index 0000000..d1cfa7e --- /dev/null +++ b/src/types/Giveaway.zig | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | |||
| 3 | chats: []Chat, | ||
| 4 | winners_selection_date: u64, | ||
| 5 | winner_count: u64, | ||
| 6 | only_new_members: bool = false, | ||
| 7 | has_public_winners: bool = false, | ||
| 8 | prize_description: ?[]const u8 = null, | ||
| 9 | country_codes: ?[]const u8 = null, | ||
| 10 | premium_subscription_month_count: ?u64 = null, | ||
diff --git a/src/types/GiveawayCompleted.zig b/src/types/GiveawayCompleted.zig new file mode 100644 index 0000000..9e07ad9 --- /dev/null +++ b/src/types/GiveawayCompleted.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | const Message = @import("Message.zig"); | ||
| 2 | |||
| 3 | winner_count: u64, | ||
| 4 | unclaimed_prize_count: ?u64 = null, | ||
| 5 | giveaway_message: ?Message = null, | ||
diff --git a/src/types/GiveawayCreated.zig b/src/types/GiveawayCreated.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/GiveawayCreated.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/GiveawayWinners.zig b/src/types/GiveawayWinners.zig new file mode 100644 index 0000000..b99a7d2 --- /dev/null +++ b/src/types/GiveawayWinners.zig | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | chat: Chat, | ||
| 5 | giveaway_message_id: u64, | ||
| 6 | winners_selection_date: u64, | ||
| 7 | winner_count: u64, | ||
| 8 | winners: []User, | ||
| 9 | additional_chat_count: ?u64 = null, | ||
| 10 | premium_subscription_month_count: ?u64 = null, | ||
| 11 | unclaimed_prize_count: ?u64 = null, | ||
| 12 | only_new_members: bool = false, | ||
| 13 | was_refunded: bool = false, | ||
| 14 | prize_description: ?[]const u8 = null, | ||
diff --git a/src/types/InlineKeyboardButton.zig b/src/types/InlineKeyboardButton.zig new file mode 100644 index 0000000..be156b4 --- /dev/null +++ b/src/types/InlineKeyboardButton.zig | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | const CallbackGame = @import("CallbackGame.zig"); | ||
| 2 | const LoginUrl = @import("LoginUrl.zig"); | ||
| 3 | const SwitchInlineQueryChosenChat = @import("SwitchInlineQueryChosenChat.zig"); | ||
| 4 | const WebAppInfo = @import("WebAppInfo.zig"); | ||
| 5 | |||
| 6 | text: []const u8, | ||
| 7 | url: ?[]const u8 = null, | ||
| 8 | callback_data: ?[]const u8 = null, | ||
| 9 | web_app: ?WebAppInfo = null, | ||
| 10 | login_url: ?LoginUrl = null, | ||
| 11 | switch_inline_query: ?[]const u8 = null, | ||
| 12 | switch_inline_query_current_chat: ?[]const u8 = null, | ||
| 13 | switch_inline_query_chosen_chat: ?SwitchInlineQueryChosenChat = null, | ||
| 14 | callback_game: ?CallbackGame = null, | ||
| 15 | pay: bool = false, | ||
diff --git a/src/types/InlineKeyboardMarkup.zig b/src/types/InlineKeyboardMarkup.zig new file mode 100644 index 0000000..388d4fc --- /dev/null +++ b/src/types/InlineKeyboardMarkup.zig | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | const InlineKeyboardButton = @import("InlineKeyboardButton.zig"); | ||
| 2 | |||
| 3 | inline_keyboard: [][]InlineKeyboardButton, | ||
diff --git a/src/types/InlineQuery.zig b/src/types/InlineQuery.zig new file mode 100644 index 0000000..7cbbe20 --- /dev/null +++ b/src/types/InlineQuery.zig | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | const Location = @import("Location.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | pub const ChatType = enum { | ||
| 5 | sender, | ||
| 6 | private, | ||
| 7 | group, | ||
| 8 | supergroup, | ||
| 9 | channel, | ||
| 10 | }; | ||
| 11 | |||
| 12 | id: []const u8, | ||
| 13 | from: User, | ||
| 14 | query: []const u8, | ||
| 15 | offset: []const u8, | ||
| 16 | chat_type: ?ChatType, | ||
| 17 | location: ?Location, | ||
diff --git a/src/types/Invoice.zig b/src/types/Invoice.zig new file mode 100644 index 0000000..5ff6bfd --- /dev/null +++ b/src/types/Invoice.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | title: []const u8, | ||
| 2 | description: []const u8, | ||
| 3 | start_parameter: []const u8, | ||
| 4 | currency: []const u8, | ||
| 5 | total_amount: u64, | ||
diff --git a/src/types/LinkPreviewOptions.zig b/src/types/LinkPreviewOptions.zig new file mode 100644 index 0000000..c8258e7 --- /dev/null +++ b/src/types/LinkPreviewOptions.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | is_disabled: ?bool = null, | ||
| 2 | url: ?[]const u8 = null, | ||
| 3 | prefer_small_media: ?bool = null, | ||
| 4 | prefer_large_media: ?bool = null, | ||
| 5 | show_above_text: ?bool = null, | ||
diff --git a/src/types/Location.zig b/src/types/Location.zig new file mode 100644 index 0000000..1fef4e3 --- /dev/null +++ b/src/types/Location.zig | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | latitude: f32, | ||
| 2 | longitude: f32, | ||
| 3 | horizontal_accuracy: ?f32 = null, | ||
| 4 | live_period: ?u64 = null, | ||
| 5 | heading: ?u64 = null, | ||
| 6 | proximity_alert_radius: ?u64 = null, | ||
diff --git a/src/types/LoginUrl.zig b/src/types/LoginUrl.zig new file mode 100644 index 0000000..37b89f6 --- /dev/null +++ b/src/types/LoginUrl.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | url: []const u8, | ||
| 2 | forward_text: ?[]const u8 = null, | ||
| 3 | bot_username: ?[]const u8 = null, | ||
| 4 | request_write_access: ?[]const u8 = null, | ||
diff --git a/src/types/MaskPosition.zig b/src/types/MaskPosition.zig new file mode 100644 index 0000000..ba668c4 --- /dev/null +++ b/src/types/MaskPosition.zig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | pub const Point = enum { | ||
| 2 | forehead, | ||
| 3 | eyes, | ||
| 4 | mouth, | ||
| 5 | chin, | ||
| 6 | }; | ||
| 7 | |||
| 8 | point: Point, | ||
| 9 | x_shift: f32, | ||
| 10 | y_shift: f32, | ||
| 11 | scale: f32, | ||
diff --git a/src/types/Message.zig b/src/types/Message.zig new file mode 100644 index 0000000..448ca86 --- /dev/null +++ b/src/types/Message.zig | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | const Animation = @import("Animation.zig"); | ||
| 2 | const Audio = @import("Audio.zig"); | ||
| 3 | const Chat = @import("Chat.zig"); | ||
| 4 | const ChatBackground = @import("ChatBackground.zig"); | ||
| 5 | const ChatBoostAdded = @import("ChatBoostAdded.zig"); | ||
| 6 | const ChatShared = @import("ChatShared.zig"); | ||
| 7 | const Contact = @import("Contact.zig"); | ||
| 8 | const Dice = @import("Dice.zig"); | ||
| 9 | const Document = @import("Document.zig"); | ||
| 10 | const ExternalReplyInfo = @import("ExternalReplyInfo.zig"); | ||
| 11 | const ForumTopicClosed = @import("ForumTopicClosed.zig"); | ||
| 12 | const ForumTopicCreated = @import("ForumTopicCreated.zig"); | ||
| 13 | const ForumTopicEdited = @import("ForumTopicEdited.zig"); | ||
| 14 | const ForumTopicReopened = @import("ForumTopicReopened.zig"); | ||
| 15 | const Game = @import("Game.zig"); | ||
| 16 | const GeneralForumTopicHidden = @import("GeneralForumTopicHidden.zig"); | ||
| 17 | const GeneralForumTopicUnhidden = @import("GeneralForumTopicUnhidden.zig"); | ||
| 18 | const Giveaway = @import("Giveaway.zig"); | ||
| 19 | const GiveawayCompleted = @import("GiveawayCompleted.zig"); | ||
| 20 | const GiveawayCreated = @import("GiveawayCreated.zig"); | ||
| 21 | const GiveawayWinners = @import("GiveawayWinners.zig"); | ||
| 22 | const InlineKeyboardMarkup = @import("InlineKeyboardMarkup.zig"); | ||
| 23 | const Invoice = @import("Invoice.zig"); | ||
| 24 | const LinkPreviewOptions = @import("LinkPreviewOptions.zig"); | ||
| 25 | const Location = @import("Location.zig"); | ||
| 26 | const MaybeInaccessibleMessage = @This(); | ||
| 27 | const Message = @This(); | ||
| 28 | const MessageAutoDeleteTimerChanged = @import("MessageAutoDeleteTimerChanged.zig"); | ||
| 29 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 30 | const MessageOrigin = @import("message_origin.zig").MessageOrigin; | ||
| 31 | const PaidMediaInfo = @import("PaidMediaInfo.zig"); | ||
| 32 | const PassportData = @import("PassportData.zig"); | ||
| 33 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 34 | const Poll = @import("Poll.zig"); | ||
| 35 | const ProximityAlertTriggered = @import("ProximityAlertTriggered.zig"); | ||
| 36 | const RefundedPayment = @import("RefundedPayment.zig"); | ||
| 37 | const Sticker = @import("Sticker.zig"); | ||
| 38 | const Story = @import("Story.zig"); | ||
| 39 | const SuccessfulPayment = @import("SuccessfulPayment.zig"); | ||
| 40 | const TextQuote = @import("TextQuote.zig"); | ||
| 41 | const User = @import("User.zig"); | ||
| 42 | const UsersShared = @import("UsersShared.zig"); | ||
| 43 | const Venue = @import("Venue.zig"); | ||
| 44 | const Video = @import("Video.zig"); | ||
| 45 | const VideoChatEnded = @import("VideoChatEnded.zig"); | ||
| 46 | const VideoChatParticipantsInvited = @import("VideoChatParticipantsInvited.zig"); | ||
| 47 | const VideoChatScheduled = @import("VideoChatScheduled.zig"); | ||
| 48 | const VideoChatStarted = @import("VideoChatStarted.zig"); | ||
| 49 | const VideoNote = @import("VideoNote.zig"); | ||
| 50 | const Voice = @import("Voice.zig"); | ||
| 51 | const WebAppData = @import("WebAppData.zig"); | ||
| 52 | const WriteAccessAllowed = @import("WriteAccessAllowed.zig"); | ||
| 53 | |||
| 54 | message_id: u64, | ||
| 55 | message_thread_id: ?u64 = null, | ||
| 56 | from: ?User = null, | ||
| 57 | sender_chat: ?Chat = null, | ||
| 58 | sender_boost_count: ?u64 = null, | ||
| 59 | sender_business_bot: ?User = null, | ||
| 60 | // If this is a MaybeInaccessibleMessage this will be 0 if this is inaccessible | ||
| 61 | date: u64, | ||
| 62 | business_connection_id: ?[]const u8 = null, | ||
| 63 | chat: Chat, | ||
| 64 | forward_origin: ?MessageOrigin = null, | ||
| 65 | is_topic_message: bool = false, | ||
| 66 | is_automatic_forward: bool = false, | ||
| 67 | reply_to_message: ?*Message = null, | ||
| 68 | external_reply: ?ExternalReplyInfo = null, | ||
| 69 | quote: ?TextQuote = null, | ||
| 70 | reply_to_story: ?Story = null, | ||
| 71 | via_bot: ?User = null, | ||
| 72 | edit_date: ?u64 = null, | ||
| 73 | has_protected_content: bool = false, | ||
| 74 | is_from_offline: bool = false, | ||
| 75 | media_group_id: ?[]const u8 = null, | ||
| 76 | author_signature: ?[]const u8 = null, | ||
| 77 | text: ?[]const u8 = null, | ||
| 78 | entities: ?[]MessageEntity = null, | ||
| 79 | link_preview_options: ?LinkPreviewOptions = null, | ||
| 80 | effect_id: ?[]const u8 = null, | ||
| 81 | animation: ?Animation = null, | ||
| 82 | audio: ?Audio = null, | ||
| 83 | document: ?Document = null, | ||
| 84 | paid_media: ?PaidMediaInfo = null, | ||
| 85 | photo: ?[]PhotoSize = null, | ||
| 86 | sticker: ?Sticker = null, | ||
| 87 | story: ?Story = null, | ||
| 88 | video: ?Video = null, | ||
| 89 | video_note: ?VideoNote = null, | ||
| 90 | voice: ?Voice = null, | ||
| 91 | caption: ?[]const u8 = null, | ||
| 92 | caption_entities: ?[]MessageEntity = null, | ||
| 93 | show_caption_above_media: bool = false, | ||
| 94 | has_media_spoiler: bool = false, | ||
| 95 | contact: ?Contact = null, | ||
| 96 | dice: ?Dice = null, | ||
| 97 | game: ?Game = null, | ||
| 98 | poll: ?Poll = null, | ||
| 99 | venue: ?Venue = null, | ||
| 100 | location: ?Location = null, | ||
| 101 | new_chat_members: ?[]User = null, | ||
| 102 | left_chat_member: ?User = null, | ||
| 103 | new_chat_title: ?[]const u8 = null, | ||
| 104 | new_chat_photo: ?[]PhotoSize = null, | ||
| 105 | delete_chat_photo: bool = false, | ||
| 106 | group_chat_created: bool = false, | ||
| 107 | supergroup_chat_created: bool = false, | ||
| 108 | channel_chat_created: bool = false, | ||
| 109 | message_auto_delete_timer_changed: ?MessageAutoDeleteTimerChanged = null, | ||
| 110 | migrate_to_chat_id: ?i64 = null, | ||
| 111 | migrate_from_chat_id: ?i64 = null, | ||
| 112 | pinned_message: ?*MaybeInaccessibleMessage = null, | ||
| 113 | invoice: ?Invoice = null, | ||
| 114 | successful_payment: ?SuccessfulPayment = null, | ||
| 115 | refunded_payment: ?RefundedPayment = null, | ||
| 116 | users_shared: ?UsersShared = null, | ||
| 117 | chat_shared: ?ChatShared = null, | ||
| 118 | connected_website: ?[]const u8 = null, | ||
| 119 | write_access_allowed: ?WriteAccessAllowed = null, | ||
| 120 | passport_data: ?PassportData = null, | ||
| 121 | proximity_alert_triggered: ?ProximityAlertTriggered = null, | ||
| 122 | boost_added: ?ChatBoostAdded = null, | ||
| 123 | chat_background_set: ?ChatBackground = null, | ||
| 124 | forum_topic_created: ?ForumTopicCreated = null, | ||
| 125 | forum_topic_edited: ?ForumTopicEdited = null, | ||
| 126 | forum_topic_closed: ?ForumTopicClosed = null, | ||
| 127 | forum_topic_reopened: ?ForumTopicReopened = null, | ||
| 128 | general_forum_topic_hidden: ?GeneralForumTopicHidden = null, | ||
| 129 | general_forum_topic_unhidden: ?GeneralForumTopicUnhidden = null, | ||
| 130 | giveaway_created: ?GiveawayCreated = null, | ||
| 131 | giveaway: ?Giveaway = null, | ||
| 132 | giveaway_winners: ?GiveawayWinners = null, | ||
| 133 | giveaway_completed: ?*GiveawayCompleted = null, | ||
| 134 | video_chat_scheduled: ?VideoChatScheduled = null, | ||
| 135 | video_chat_started: ?VideoChatStarted = null, | ||
| 136 | video_chat_ended: ?VideoChatEnded = null, | ||
| 137 | video_chat_participants_invited: ?VideoChatParticipantsInvited = null, | ||
| 138 | web_app_data: ?WebAppData = null, | ||
| 139 | reply_markup: ?InlineKeyboardMarkup = null, | ||
diff --git a/src/types/MessageAutoDeleteTimerChanged.zig b/src/types/MessageAutoDeleteTimerChanged.zig new file mode 100644 index 0000000..c73e682 --- /dev/null +++ b/src/types/MessageAutoDeleteTimerChanged.zig | |||
| @@ -0,0 +1 @@ | |||
| message_auto_delete_time: u64, | |||
diff --git a/src/types/MessageEntity.zig b/src/types/MessageEntity.zig new file mode 100644 index 0000000..1c44d20 --- /dev/null +++ b/src/types/MessageEntity.zig | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | const MessageEntity = @This(); | ||
| 4 | const User = @import("User.zig"); | ||
| 5 | const Utf8View = std.unicode.Utf8View; | ||
| 6 | |||
| 7 | pub const Type = enum { | ||
| 8 | mention, | ||
| 9 | hashtag, | ||
| 10 | cashtag, | ||
| 11 | bot_command, | ||
| 12 | url, | ||
| 13 | email, | ||
| 14 | phone_number, | ||
| 15 | bold, | ||
| 16 | italic, | ||
| 17 | underline, | ||
| 18 | strikethrough, | ||
| 19 | spoiler, | ||
| 20 | blockquote, | ||
| 21 | expandable_blockquote, | ||
| 22 | code, | ||
| 23 | pre, | ||
| 24 | text_link, | ||
| 25 | text_mention, | ||
| 26 | custom_emoji, | ||
| 27 | }; | ||
| 28 | |||
| 29 | type: Type, | ||
| 30 | offset: u64, | ||
| 31 | length: u64, | ||
| 32 | url: ?[]const u8 = null, | ||
| 33 | user: ?User = null, | ||
| 34 | language: ?[]const u8 = null, | ||
| 35 | custom_emoji_id: ?[]const u8 = null, | ||
| 36 | |||
| 37 | pub fn extract(self: MessageEntity, src: []const u8) ![]const u8 { | ||
| 38 | if (self.length == 0) { | ||
| 39 | return ""; | ||
| 40 | } | ||
| 41 | |||
| 42 | var utf8 = (try Utf8View.init(src)).iterator(); | ||
| 43 | var i: usize = 0; | ||
| 44 | |||
| 45 | const start = if (i >= self.offset) | ||
| 46 | utf8.i | ||
| 47 | else blk: { | ||
| 48 | while (utf8.nextCodepoint()) |cp| { | ||
| 49 | i += std.unicode.utf16CodepointSequenceLength(cp) catch unreachable; | ||
| 50 | if (i >= self.offset) { | ||
| 51 | break :blk utf8.i; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | return ""; | ||
| 55 | }; | ||
| 56 | |||
| 57 | i = 0; | ||
| 58 | while (utf8.nextCodepoint()) |cp| { | ||
| 59 | i += std.unicode.utf16CodepointSequenceLength(cp) catch unreachable; | ||
| 60 | if (i >= self.length) { | ||
| 61 | return src[start..utf8.i]; | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | return src[start..]; | ||
| 66 | } | ||
diff --git a/src/types/MessageReactionCountUpdated.zig b/src/types/MessageReactionCountUpdated.zig new file mode 100644 index 0000000..48a9f24 --- /dev/null +++ b/src/types/MessageReactionCountUpdated.zig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const ReactionCount = @import("ReactionCount.zig"); | ||
| 3 | |||
| 4 | chat: Chat, | ||
| 5 | message_id: u64, | ||
| 6 | date: u64, | ||
| 7 | reactions: []ReactionCount, | ||
diff --git a/src/types/MessageReactionUpdated.zig b/src/types/MessageReactionUpdated.zig new file mode 100644 index 0000000..7da679b --- /dev/null +++ b/src/types/MessageReactionUpdated.zig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const ReactionType = @import("reaction_type.zig").ReactionType; | ||
| 3 | const User = @import("User.zig"); | ||
| 4 | |||
| 5 | chat: Chat, | ||
| 6 | message_id: u64, | ||
| 7 | user: ?User = null, | ||
| 8 | actor_chat: ?Chat = null, | ||
| 9 | date: u64, | ||
| 10 | old_reaction: []ReactionType, | ||
| 11 | new_reaction: []ReactionType, | ||
diff --git a/src/types/OrderInfo.zig b/src/types/OrderInfo.zig new file mode 100644 index 0000000..3f94376 --- /dev/null +++ b/src/types/OrderInfo.zig | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | const ShippingAddress = @import("ShippingAddress.zig"); | ||
| 2 | |||
| 3 | name: ?[]const u8 = null, | ||
| 4 | phone_number: ?[]const u8 = null, | ||
| 5 | email: ?[]const u8 = null, | ||
| 6 | shipping_address: ?ShippingAddress = null, | ||
diff --git a/src/types/PaidMediaInfo.zig b/src/types/PaidMediaInfo.zig new file mode 100644 index 0000000..6de7447 --- /dev/null +++ b/src/types/PaidMediaInfo.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | const PaidMedia = @import("paid_media.zig").PaidMedia; | ||
| 2 | |||
| 3 | star_count: u64, | ||
| 4 | paid_media: []PaidMedia, | ||
diff --git a/src/types/PassportData.zig b/src/types/PassportData.zig new file mode 100644 index 0000000..679534c --- /dev/null +++ b/src/types/PassportData.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | const EncryptedCredentials = @import("EncryptedCredentials.zig"); | ||
| 2 | const EncryptedPassportElement = @import("EncryptedPassportElement.zig"); | ||
| 3 | |||
| 4 | data: []EncryptedPassportElement, | ||
| 5 | credentials: EncryptedCredentials, | ||
diff --git a/src/types/PassportFile.zig b/src/types/PassportFile.zig new file mode 100644 index 0000000..2b208fa --- /dev/null +++ b/src/types/PassportFile.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | file_id: []const u8, | ||
| 2 | file_unique_id: []const u8, | ||
| 3 | file_size: u64, | ||
| 4 | file_date: u64, | ||
diff --git a/src/types/PhotoSize.zig b/src/types/PhotoSize.zig new file mode 100644 index 0000000..887b530 --- /dev/null +++ b/src/types/PhotoSize.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | file_id: []const u8, | ||
| 2 | file_unique_id: []const u8, | ||
| 3 | width: u64, | ||
| 4 | height: u64, | ||
| 5 | file_size: ?u64 = null, | ||
diff --git a/src/types/Poll.zig b/src/types/Poll.zig new file mode 100644 index 0000000..ccc3b68 --- /dev/null +++ b/src/types/Poll.zig | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 2 | const PollOption = @import("PollOption.zig"); | ||
| 3 | |||
| 4 | pub const Type = enum { | ||
| 5 | regular, | ||
| 6 | quiz, | ||
| 7 | }; | ||
| 8 | |||
| 9 | id: []const u8, | ||
| 10 | question: []const u8, | ||
| 11 | question_entities: ?[]MessageEntity = null, | ||
| 12 | options: []PollOption, | ||
| 13 | total_voter_count: u64, | ||
| 14 | is_closed: bool, | ||
| 15 | is_anonymous: bool, | ||
| 16 | type: Type, | ||
| 17 | allows_multiple_answers: bool, | ||
| 18 | correct_option_id: ?u64 = null, | ||
| 19 | explanation: ?[]const u8 = null, | ||
| 20 | explanation_entities: ?[]MessageEntity = null, | ||
| 21 | open_period: ?u64 = null, | ||
| 22 | close_date: ?u64 = null, | ||
diff --git a/src/types/PollAnswer.zig b/src/types/PollAnswer.zig new file mode 100644 index 0000000..7d4985c --- /dev/null +++ b/src/types/PollAnswer.zig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | poll_id: []const u8, | ||
| 5 | voter_chat: ?Chat, | ||
| 6 | user: ?User, | ||
| 7 | option_ids: []u64, | ||
diff --git a/src/types/PollOption.zig b/src/types/PollOption.zig new file mode 100644 index 0000000..870bfee --- /dev/null +++ b/src/types/PollOption.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 2 | |||
| 3 | text: []const u8, | ||
| 4 | text_entities: ?[]MessageEntity = null, | ||
| 5 | voter_count: u64, | ||
diff --git a/src/types/PreCheckoutQuery.zig b/src/types/PreCheckoutQuery.zig new file mode 100644 index 0000000..48e013f --- /dev/null +++ b/src/types/PreCheckoutQuery.zig | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | const OrderInfo = @import("OrderInfo.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | id: []const u8, | ||
| 5 | from: User, | ||
| 6 | currency: []const u8, | ||
| 7 | total_amount: u64, | ||
| 8 | invoice_payload: []const u8, | ||
| 9 | shipping_option_id: ?[]const u8, | ||
| 10 | order_info: ?OrderInfo, | ||
diff --git a/src/types/ProximityAlertTriggered.zig b/src/types/ProximityAlertTriggered.zig new file mode 100644 index 0000000..db5159d --- /dev/null +++ b/src/types/ProximityAlertTriggered.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | const User = @import("User.zig"); | ||
| 2 | |||
| 3 | traveler: User, | ||
| 4 | watcher: User, | ||
| 5 | distance: u64, | ||
diff --git a/src/types/ReactionCount.zig b/src/types/ReactionCount.zig new file mode 100644 index 0000000..7c6a0bc --- /dev/null +++ b/src/types/ReactionCount.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | const ReactionType = @import("reaction_type.zig").ReactionType; | ||
| 2 | |||
| 3 | type: ReactionType, | ||
| 4 | total_count: u64, | ||
diff --git a/src/types/RefundedPayment.zig b/src/types/RefundedPayment.zig new file mode 100644 index 0000000..31f04c0 --- /dev/null +++ b/src/types/RefundedPayment.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | currency: []const u8, | ||
| 2 | total_amount: u64, | ||
| 3 | invoice_payload: []const u8, | ||
| 4 | telegram_payment_charge_id: []const u8, | ||
| 5 | provider_payment_charge_id: []const u8, | ||
diff --git a/src/types/ReplyParameters.zig b/src/types/ReplyParameters.zig new file mode 100644 index 0000000..57d75c2 --- /dev/null +++ b/src/types/ReplyParameters.zig | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | message_id: u64, | ||
| 2 | // TODO: Integer OR String | ||
| 3 | chat_id: ?i64 = null, | ||
| 4 | allow_sending_without_reply: ?bool = null, | ||
| 5 | quote: ?[]const u8 = null, | ||
| 6 | // one of quote_parse_mode or quote_entities | ||
| 7 | quote_parse_mode: ?[]const u8 = null, | ||
| 8 | quote_entities: ?[]const u8 = null, | ||
| 9 | quote_position: ?u64 = null, | ||
diff --git a/src/types/ResponseParameters.zig b/src/types/ResponseParameters.zig new file mode 100644 index 0000000..655c4f9 --- /dev/null +++ b/src/types/ResponseParameters.zig | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | migrate_to_chat_id: ?i64 = null, | ||
| 2 | retry_after: ?i64 = null, | ||
diff --git a/src/types/SendMessageParams.zig b/src/types/SendMessageParams.zig new file mode 100644 index 0000000..8c84940 --- /dev/null +++ b/src/types/SendMessageParams.zig | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | const LinkPreviewOptions = @import("LinkPreviewOptions.zig"); | ||
| 2 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 3 | const ParseMode = @import("parse_mode.zig").ParseMode; | ||
| 4 | const ReplyParameters = @import("ReplyParameters.zig"); | ||
| 5 | |||
| 6 | business_connection_id: ?[]const u8 = null, | ||
| 7 | // TODO: Integer or String | ||
| 8 | chat_id: i64, | ||
| 9 | message_thread_id: ?u64 = null, | ||
| 10 | text: []const u8, | ||
| 11 | parse_mode: ?ParseMode = null, | ||
| 12 | entities: ?[]MessageEntity = null, | ||
| 13 | link_preview_options: ?LinkPreviewOptions = null, | ||
| 14 | disable_notification: ?bool = null, | ||
| 15 | protect_content: ?bool = null, | ||
| 16 | message_effect_id: ?[]const u8 = null, | ||
| 17 | reply_parameters: ?ReplyParameters = null, | ||
| 18 | // TODO: reply_markup: InlineKeyboardMarkup OR ReplyKeyboardMarkup OR ReplyKeyboardRemove OR ForceReply | ||
diff --git a/src/types/SetMyNameParams.zig b/src/types/SetMyNameParams.zig new file mode 100644 index 0000000..0bd2f06 --- /dev/null +++ b/src/types/SetMyNameParams.zig | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | name: ?[]const u8 = null, | ||
| 2 | language_code: ?[]const u8 = null, | ||
diff --git a/src/types/SharedUser.zig b/src/types/SharedUser.zig new file mode 100644 index 0000000..4afe053 --- /dev/null +++ b/src/types/SharedUser.zig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | user_id: u64, | ||
| 4 | first_name: ?[]const u8 = null, | ||
| 5 | last_name: ?[]const u8 = null, | ||
| 6 | username: ?[]const u8 = null, | ||
| 7 | photo: ?[]PhotoSize = null, | ||
diff --git a/src/types/ShippingAddress.zig b/src/types/ShippingAddress.zig new file mode 100644 index 0000000..f4203fe --- /dev/null +++ b/src/types/ShippingAddress.zig | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | country_code: []const u8, | ||
| 2 | state: []const u8, | ||
| 3 | city: []const u8, | ||
| 4 | street_line1: []const u8, | ||
| 5 | street_line2: []const u8, | ||
| 6 | post_code: []const u8, | ||
diff --git a/src/types/ShippingQuery.zig b/src/types/ShippingQuery.zig new file mode 100644 index 0000000..15abcda --- /dev/null +++ b/src/types/ShippingQuery.zig | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | const ShippingAddress = @import("ShippingAddress.zig"); | ||
| 2 | const User = @import("User.zig"); | ||
| 3 | |||
| 4 | id: []const u8, | ||
| 5 | from: User, | ||
| 6 | invoice_payload: []const u8, | ||
| 7 | shipping_address: ShippingAddress, | ||
diff --git a/src/types/Sticker.zig b/src/types/Sticker.zig new file mode 100644 index 0000000..e28df69 --- /dev/null +++ b/src/types/Sticker.zig | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | const File = @import("File.zig"); | ||
| 2 | const MaskPosition = @import("MaskPosition.zig"); | ||
| 3 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 4 | |||
| 5 | pub const Type = enum { | ||
| 6 | regular, | ||
| 7 | mask, | ||
| 8 | custom_emoji, | ||
| 9 | }; | ||
| 10 | |||
| 11 | file_id: []const u8, | ||
| 12 | file_unique_id: []const u8, | ||
| 13 | type: Type, | ||
| 14 | width: u64, | ||
| 15 | height: u64, | ||
| 16 | is_animated: bool = false, | ||
| 17 | is_video: bool = false, | ||
| 18 | thumbnail: ?PhotoSize = null, | ||
| 19 | emoji: ?[]const u8 = null, | ||
| 20 | set_name: ?[]const u8 = null, | ||
| 21 | premium_animation: ?File = null, | ||
| 22 | mask_position: ?MaskPosition = null, | ||
| 23 | custom_emoji_id: ?[]const u8 = null, | ||
| 24 | needs_repainting: bool = false, | ||
| 25 | file_size: ?u64 = null, | ||
diff --git a/src/types/Story.zig b/src/types/Story.zig new file mode 100644 index 0000000..479b7a9 --- /dev/null +++ b/src/types/Story.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | const Chat = @import("Chat.zig"); | ||
| 2 | |||
| 3 | chat: Chat, | ||
| 4 | id: u64, | ||
diff --git a/src/types/SuccessfulPayment.zig b/src/types/SuccessfulPayment.zig new file mode 100644 index 0000000..c508f48 --- /dev/null +++ b/src/types/SuccessfulPayment.zig | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | const OrderInfo = @import("OrderInfo.zig"); | ||
| 2 | |||
| 3 | currency: []const u8, | ||
| 4 | total_amount: u64, | ||
| 5 | invoice_payload: []const u8, | ||
| 6 | shipping_option_id: ?[]const u8 = null, | ||
| 7 | order_info: ?OrderInfo = null, | ||
| 8 | telegram_payment_charge_id: []const u8, | ||
| 9 | provider_payment_charge_id: []const u8, | ||
diff --git a/src/types/SwitchInlineQueryChosenChat.zig b/src/types/SwitchInlineQueryChosenChat.zig new file mode 100644 index 0000000..860f2d9 --- /dev/null +++ b/src/types/SwitchInlineQueryChosenChat.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | query: ?[]const u8, | ||
| 2 | allow_user_chats: ?bool = null, | ||
| 3 | allow_bot_chats: ?bool = null, | ||
| 4 | allow_group_chats: ?bool = null, | ||
| 5 | allow_channel_chats: ?bool = null, | ||
diff --git a/src/types/TextQuote.zig b/src/types/TextQuote.zig new file mode 100644 index 0000000..6dc6be2 --- /dev/null +++ b/src/types/TextQuote.zig | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | const MessageEntity = @import("MessageEntity.zig"); | ||
| 2 | |||
| 3 | text: []const u8, | ||
| 4 | entities: ?[]MessageEntity = null, | ||
| 5 | position: u64, | ||
| 6 | is_manual: bool = false, | ||
diff --git a/src/types/Update.zig b/src/types/Update.zig new file mode 100644 index 0000000..0491110 --- /dev/null +++ b/src/types/Update.zig | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | const BusinessConnection = @import("BusinessConnection.zig"); | ||
| 2 | const BusinessMessagesDeleted = @import("BusinessMessagesDeleted.zig"); | ||
| 3 | const CallbackQuery = @import("CallbackQuery.zig"); | ||
| 4 | const ChatBoostRemoved = @import("ChatBoostRemoved.zig"); | ||
| 5 | const ChatBoostUpdated = @import("ChatBoostUpdated.zig"); | ||
| 6 | const ChatJoinRequest = @import("ChatJoinRequest.zig"); | ||
| 7 | const ChatMemberUpdated = @import("ChatMemberUpdated.zig"); | ||
| 8 | const ChosenInlineResult = @import("ChosenInlineResult.zig"); | ||
| 9 | const InlineQuery = @import("InlineQuery.zig"); | ||
| 10 | const Message = @import("Message.zig"); | ||
| 11 | const MessageReactionCountUpdated = @import("MessageReactionCountUpdated.zig"); | ||
| 12 | const MessageReactionUpdated = @import("MessageReactionUpdated.zig"); | ||
| 13 | const Poll = @import("Poll.zig"); | ||
| 14 | const PollAnswer = @import("PollAnswer.zig"); | ||
| 15 | const PreCheckoutQuery = @import("PreCheckoutQuery.zig"); | ||
| 16 | const ShippingQuery = @import("ShippingQuery.zig"); | ||
| 17 | |||
| 18 | // TODO: Make this into a tagged union | ||
| 19 | update_id: u64, | ||
| 20 | message: ?Message = null, | ||
| 21 | edited_message: ?Message = null, | ||
| 22 | channel_post: ?Message = null, | ||
| 23 | edited_channel_post: ?Message = null, | ||
| 24 | business_connection: ?BusinessConnection = null, | ||
| 25 | business_message: ?Message = null, | ||
| 26 | edited_business_message: ?Message = null, | ||
| 27 | deleted_business_messages: ?BusinessMessagesDeleted = null, | ||
| 28 | message_reaction: ?MessageReactionUpdated = null, | ||
| 29 | message_reaction_count: ?MessageReactionCountUpdated = null, | ||
| 30 | inline_query: ?InlineQuery = null, | ||
| 31 | chosen_inline_result: ?ChosenInlineResult = null, | ||
| 32 | callback_query: ?CallbackQuery = null, | ||
| 33 | shipping_query: ?ShippingQuery = null, | ||
| 34 | pre_checkout_query: ?PreCheckoutQuery = null, | ||
| 35 | poll: ?Poll = null, | ||
| 36 | poll_answer: ?PollAnswer = null, | ||
| 37 | my_chat_member: ?ChatMemberUpdated = null, | ||
| 38 | chat_member: ?ChatMemberUpdated = null, | ||
| 39 | chat_join_request: ?ChatJoinRequest = null, | ||
| 40 | chat_boost: ?ChatBoostUpdated = null, | ||
| 41 | removed_chat_boost: ?ChatBoostRemoved = null, | ||
diff --git a/src/types/User.zig b/src/types/User.zig new file mode 100644 index 0000000..dc06097 --- /dev/null +++ b/src/types/User.zig | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | const textutils = @import("../textutils.zig"); | ||
| 2 | |||
| 3 | const User = @This(); | ||
| 4 | |||
| 5 | id: i64, | ||
| 6 | is_bot: bool, | ||
| 7 | first_name: []const u8, | ||
| 8 | last_name: ?[]const u8 = null, | ||
| 9 | username: ?[]const u8 = null, | ||
| 10 | language_code: ?[]const u8 = null, | ||
| 11 | is_premium: bool = false, | ||
| 12 | added_to_attachment_menu: bool = false, | ||
| 13 | can_join_groups: bool = false, | ||
| 14 | can_read_all_group_messages: bool = false, | ||
| 15 | supports_inline_queries: bool = false, | ||
| 16 | can_connect_to_business: bool = false, | ||
| 17 | |||
| 18 | pub fn writeFormattedName(self: User, w: anytype) !void { | ||
| 19 | try w.print("<a href=\"tg://user?id={}\"><i>", .{self.id}); | ||
| 20 | try textutils.escapeXml(w, self.first_name); | ||
| 21 | if (self.last_name) |last_name| { | ||
| 22 | try w.writeByte(' '); | ||
| 23 | try textutils.escapeXml(w, last_name); | ||
| 24 | } | ||
| 25 | try w.writeAll("</i>"); | ||
| 26 | |||
| 27 | if (self.username) |username| { | ||
| 28 | try w.writeAll(" @"); | ||
| 29 | try textutils.escapeXml(w, username); | ||
| 30 | } | ||
| 31 | try w.print("</a> [<code>{}</code>]", .{self.id}); | ||
| 32 | } | ||
diff --git a/src/types/UsersShared.zig b/src/types/UsersShared.zig new file mode 100644 index 0000000..0fff785 --- /dev/null +++ b/src/types/UsersShared.zig | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | const SharedUser = @import("SharedUser.zig"); | ||
| 2 | |||
| 3 | request_id: u64, | ||
| 4 | users: []SharedUser, | ||
diff --git a/src/types/Venue.zig b/src/types/Venue.zig new file mode 100644 index 0000000..6ae61f3 --- /dev/null +++ b/src/types/Venue.zig | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | const Location = @import("Location.zig"); | ||
| 2 | |||
| 3 | location: Location, | ||
| 4 | title: []const u8, | ||
| 5 | address: []const u8, | ||
| 6 | foursquare_id: ?[]const u8 = null, | ||
| 7 | foursquare_type: ?[]const u8 = null, | ||
| 8 | google_place_id: ?[]const u8 = null, | ||
| 9 | google_place_type: ?[]const u8 = null, | ||
diff --git a/src/types/Video.zig b/src/types/Video.zig new file mode 100644 index 0000000..8330637 --- /dev/null +++ b/src/types/Video.zig | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | file_id: []const u8, | ||
| 4 | file_unique_id: []const u8, | ||
| 5 | width: u64, | ||
| 6 | height: u64, | ||
| 7 | duration: u64, | ||
| 8 | thumbnail: ?PhotoSize = null, | ||
| 9 | file_name: ?[]const u8 = null, | ||
| 10 | mime_type: ?[]const u8 = null, | ||
| 11 | file_size: ?u64 = null, | ||
diff --git a/src/types/VideoChatEnded.zig b/src/types/VideoChatEnded.zig new file mode 100644 index 0000000..748bf44 --- /dev/null +++ b/src/types/VideoChatEnded.zig | |||
| @@ -0,0 +1 @@ | |||
| duration: u64, | |||
diff --git a/src/types/VideoChatParticipantsInvited.zig b/src/types/VideoChatParticipantsInvited.zig new file mode 100644 index 0000000..22a46f7 --- /dev/null +++ b/src/types/VideoChatParticipantsInvited.zig | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | const User = @import("User.zig"); | ||
| 2 | |||
| 3 | users: []User, | ||
diff --git a/src/types/VideoChatScheduled.zig b/src/types/VideoChatScheduled.zig new file mode 100644 index 0000000..a55dfe3 --- /dev/null +++ b/src/types/VideoChatScheduled.zig | |||
| @@ -0,0 +1 @@ | |||
| start_date: u64, | |||
diff --git a/src/types/VideoChatStarted.zig b/src/types/VideoChatStarted.zig new file mode 100644 index 0000000..2f72c10 --- /dev/null +++ b/src/types/VideoChatStarted.zig | |||
| @@ -0,0 +1 @@ | |||
| // meant to be empty | |||
diff --git a/src/types/VideoNote.zig b/src/types/VideoNote.zig new file mode 100644 index 0000000..aadb318 --- /dev/null +++ b/src/types/VideoNote.zig | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 2 | |||
| 3 | file_id: []const u8, | ||
| 4 | file_unique_id: []const u8, | ||
| 5 | length: u64, | ||
| 6 | duration: u64, | ||
| 7 | thumbnail: ?PhotoSize = null, | ||
| 8 | file_size: ?u64 = null, | ||
diff --git a/src/types/Voice.zig b/src/types/Voice.zig new file mode 100644 index 0000000..609ee0b --- /dev/null +++ b/src/types/Voice.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | file_id: []const u8, | ||
| 2 | file_unique_id: []const u8, | ||
| 3 | duration: u64, | ||
| 4 | mime_type: ?[]const u8 = null, | ||
| 5 | file_size: ?u64 = null, | ||
diff --git a/src/types/WebAppData.zig b/src/types/WebAppData.zig new file mode 100644 index 0000000..e853fdc --- /dev/null +++ b/src/types/WebAppData.zig | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | data: []const u8, | ||
| 2 | button_text: []const u8, | ||
diff --git a/src/types/WebAppInfo.zig b/src/types/WebAppInfo.zig new file mode 100644 index 0000000..02fcc5e --- /dev/null +++ b/src/types/WebAppInfo.zig | |||
| @@ -0,0 +1 @@ | |||
| url: []const u8, | |||
diff --git a/src/types/WriteAccessAllowed.zig b/src/types/WriteAccessAllowed.zig new file mode 100644 index 0000000..2ff3259 --- /dev/null +++ b/src/types/WriteAccessAllowed.zig | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | from_request: ?bool = null, | ||
| 2 | web_app_name: ?[]const u8 = null, | ||
| 3 | from_attachment_menu: ?bool = null, | ||
diff --git a/src/types/background_fill.zig b/src/types/background_fill.zig new file mode 100644 index 0000000..86aaa59 --- /dev/null +++ b/src/types/background_fill.zig | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | pub const BackgroundFill = union(enum) { | ||
| 4 | solid: struct { | ||
| 5 | color: u24, | ||
| 6 | }, | ||
| 7 | gradient: struct { | ||
| 8 | top_color: u24, | ||
| 9 | bottom_color: u24, | ||
| 10 | rotation_angle: u16, | ||
| 11 | }, | ||
| 12 | freeform_gradient: struct { | ||
| 13 | colors: []const u24, | ||
| 14 | }, | ||
| 15 | |||
| 16 | pub const jsonParse = json.makeJsonParse(BackgroundFill); | ||
| 17 | }; | ||
diff --git a/src/types/background_type.zig b/src/types/background_type.zig new file mode 100644 index 0000000..220465a --- /dev/null +++ b/src/types/background_type.zig | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | const BackgroundFill = @import("background_fill.zig").BackgroundFill; | ||
| 4 | const Document = @import("Document.zig"); | ||
| 5 | |||
| 6 | pub const BackgroundType = union(enum) { | ||
| 7 | fill: struct { | ||
| 8 | fill: BackgroundFill, | ||
| 9 | dark_theme_dimming: u8, | ||
| 10 | }, | ||
| 11 | wallpaper: struct { | ||
| 12 | document: Document, | ||
| 13 | dark_theme_dimming: u8, | ||
| 14 | is_blurred: bool = false, | ||
| 15 | is_moving: bool = false, | ||
| 16 | }, | ||
| 17 | pattern: struct { | ||
| 18 | document: Document, | ||
| 19 | fill: BackgroundFill, | ||
| 20 | intensity: u8, | ||
| 21 | is_inverted: bool = false, | ||
| 22 | is_moving: bool = false, | ||
| 23 | }, | ||
| 24 | chat_theme: struct { | ||
| 25 | theme_name: []const u8, | ||
| 26 | }, | ||
| 27 | |||
| 28 | pub const jsonParse = json.makeJsonParse(BackgroundType); | ||
| 29 | pub const jsonParseFromValue = json.makeJsonParseFromValue(BackgroundType); | ||
| 30 | }; | ||
diff --git a/src/types/chat_boost_source.zig b/src/types/chat_boost_source.zig new file mode 100644 index 0000000..ead19a0 --- /dev/null +++ b/src/types/chat_boost_source.zig | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | const User = @import("User.zig"); | ||
| 4 | |||
| 5 | pub const ChatBoostSource = union(enum) { | ||
| 6 | premium: struct { | ||
| 7 | user: User, | ||
| 8 | }, | ||
| 9 | gift_code: struct { | ||
| 10 | user: User, | ||
| 11 | }, | ||
| 12 | giveaway: struct { | ||
| 13 | giveaway_message_id: u64, | ||
| 14 | user: ?User = null, | ||
| 15 | is_unclaimed: bool = false, | ||
| 16 | }, | ||
| 17 | |||
| 18 | pub const jsonParse = json.makeJsonParse(ChatBoostSource); | ||
| 19 | pub const jsonParseFromValue = json.makeJsonParseFromValue(ChatBoostSource); | ||
| 20 | }; | ||
diff --git a/src/types/chat_member.zig b/src/types/chat_member.zig new file mode 100644 index 0000000..7650299 --- /dev/null +++ b/src/types/chat_member.zig | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | const User = @import("User.zig"); | ||
| 4 | |||
| 5 | pub const ChatMember = union(enum) { | ||
| 6 | creator: struct { | ||
| 7 | user: User, | ||
| 8 | is_anonymous: bool, | ||
| 9 | custom_title: ?[]const u8 = null, | ||
| 10 | }, | ||
| 11 | administrator: struct { | ||
| 12 | user: User, | ||
| 13 | can_be_edited: bool, | ||
| 14 | is_anonymous: bool, | ||
| 15 | can_manage_chat: bool, | ||
| 16 | can_delete_messages: bool, | ||
| 17 | can_manage_video_chats: bool, | ||
| 18 | can_restrict_members: bool, | ||
| 19 | can_promote_members: bool, | ||
| 20 | can_change_info: bool, | ||
| 21 | can_invite_users: bool, | ||
| 22 | can_post_stories: bool, | ||
| 23 | can_edit_stories: bool, | ||
| 24 | can_delete_stories: bool, | ||
| 25 | can_post_messages: ?bool = null, | ||
| 26 | can_edit_messages: ?bool = null, | ||
| 27 | can_pin_messages: ?bool = null, | ||
| 28 | can_manage_topics: ?bool = null, | ||
| 29 | custom_title: ?[]const u8 = null, | ||
| 30 | }, | ||
| 31 | member: struct { | ||
| 32 | user: User, | ||
| 33 | }, | ||
| 34 | restricted: struct { | ||
| 35 | user: User, | ||
| 36 | is_member: bool, | ||
| 37 | can_send_messages: bool, | ||
| 38 | can_send_audios: bool, | ||
| 39 | can_send_documents: bool, | ||
| 40 | can_send_photos: bool, | ||
| 41 | can_send_videos: bool, | ||
| 42 | can_send_video_notes: bool, | ||
| 43 | can_send_voice_notes: bool, | ||
| 44 | can_send_polls: bool, | ||
| 45 | can_send_other_messages: bool, | ||
| 46 | can_add_web_page_previews: bool, | ||
| 47 | can_change_info: bool, | ||
| 48 | can_invite_users: bool, | ||
| 49 | can_pin_messages: bool, | ||
| 50 | can_manage_topics: bool, | ||
| 51 | until_date: u64, | ||
| 52 | }, | ||
| 53 | left: struct { | ||
| 54 | user: User, | ||
| 55 | }, | ||
| 56 | banned: struct { | ||
| 57 | user: User, | ||
| 58 | until_date: u64, | ||
| 59 | }, | ||
| 60 | |||
| 61 | pub const jsonParse = json.makeJsonParse(ChatMember); | ||
| 62 | pub const jsonParseFromValue = json.makeJsonParseFromValueWithTag(ChatMember, "status"); | ||
| 63 | }; | ||
diff --git a/src/types/message_origin.zig b/src/types/message_origin.zig new file mode 100644 index 0000000..5ca1f9f --- /dev/null +++ b/src/types/message_origin.zig | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | const Chat = @import("Chat.zig"); | ||
| 4 | const User = @import("User.zig"); | ||
| 5 | |||
| 6 | pub const MessageOrigin = union(enum) { | ||
| 7 | user: struct { | ||
| 8 | date: u64, | ||
| 9 | sender_user: User, | ||
| 10 | }, | ||
| 11 | hidden_user: struct { | ||
| 12 | date: u64, | ||
| 13 | sender_user_name: []const u8, | ||
| 14 | }, | ||
| 15 | chat: struct { | ||
| 16 | date: u64, | ||
| 17 | sender_chat: Chat, | ||
| 18 | author_signature: ?[]const u8, | ||
| 19 | }, | ||
| 20 | channel: struct { | ||
| 21 | date: u64, | ||
| 22 | chat: Chat, | ||
| 23 | message_id: u64, | ||
| 24 | author_signature: ?[]const u8, | ||
| 25 | }, | ||
| 26 | |||
| 27 | pub const jsonParse = json.makeJsonParse(MessageOrigin); | ||
| 28 | pub const jsonParseFromValue = json.makeJsonParseFromValue(MessageOrigin); | ||
| 29 | }; | ||
diff --git a/src/types/paid_media.zig b/src/types/paid_media.zig new file mode 100644 index 0000000..3b50250 --- /dev/null +++ b/src/types/paid_media.zig | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | const PhotoSize = @import("PhotoSize.zig"); | ||
| 4 | const Video = @import("Video.zig"); | ||
| 5 | |||
| 6 | pub const PaidMedia = union(enum) { | ||
| 7 | preview: struct { | ||
| 8 | width: ?u64 = null, | ||
| 9 | height: ?u64 = null, | ||
| 10 | duration: ?u64 = null, | ||
| 11 | }, | ||
| 12 | photo: struct { | ||
| 13 | photo: []PhotoSize, | ||
| 14 | }, | ||
| 15 | video: struct { | ||
| 16 | video: Video, | ||
| 17 | }, | ||
| 18 | |||
| 19 | pub const jsonParse = json.makeJsonParse(PaidMedia); | ||
| 20 | pub const jsonParseFromValue = json.makeJsonParseFromValue(PaidMedia); | ||
| 21 | }; | ||
diff --git a/src/types/parse_mode.zig b/src/types/parse_mode.zig new file mode 100644 index 0000000..7285c64 --- /dev/null +++ b/src/types/parse_mode.zig | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | pub const ParseMode = enum { | ||
| 2 | markdownv2, | ||
| 3 | html, | ||
| 4 | markdown, | ||
| 5 | }; | ||
diff --git a/src/types/reaction_type.zig b/src/types/reaction_type.zig new file mode 100644 index 0000000..416def9 --- /dev/null +++ b/src/types/reaction_type.zig | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | const json = @import("../json.zig"); | ||
| 2 | |||
| 3 | pub const ReactionType = union(enum) { | ||
| 4 | emoji: struct { | ||
| 5 | emoji: []const u8, | ||
| 6 | }, | ||
| 7 | custom_emoji: struct { | ||
| 8 | custom_emoji_id: []const u8, | ||
| 9 | }, | ||
| 10 | |||
| 11 | pub const jsonParse = json.makeJsonParse(ReactionType); | ||
| 12 | pub const jsonParseFromValue = json.makeJsonParseFromValue(ReactionType); | ||
| 13 | }; | ||