mirror of
https://github.com/lukaszraczylo/go-telegram.git
synced 2026-06-05 22:43:59 +00:00
5523ed2b06
Each sealed-interface union with N variants used to emit N typed-string
enums, one per variant, each holding exactly one wire value. Codegen now
detects this pattern and emits ONE unified enum at the union level,
retyping every variant's discriminator field to point at it.
Unified enums (11 unions, 44 constants total):
- ChatMemberStatus (6)
- MessageOriginType (4)
- BackgroundFillType (3)
- BackgroundTypeKind (4)
- ChatBoostSourceKind (3)
- OwnedGiftType (2)
- PaidMediaType (4)
- ReactionTypeKind (3)
- RevenueWithdrawalStateKind (3)
- StoryAreaTypeKind (5)
- TransactionPartnerType (7)
Naming-collision cases (union name already ends in a discriminator
concept noun, so the natural concat would stutter): BackgroundType,
ReactionType, StoryAreaType, ChatBoostSource, RevenueWithdrawalState.
The unified name ends with 'Kind' instead.
44 obsolete per-variant single-value enum types removed (e.g.
ChatMemberOwnerStatus, MessageOriginUserType). The variant struct types
themselves (ChatMemberOwner etc.) are unchanged; only their per-variant
single-value enum aliases go away.
Auto-inject MarshalJSON (commit 370c9c0) is unaffected — variant wire
values still come from the discriminator-extractor pass.
Call-site cleanup:
- dispatch/filters/chatmember/chatmember_test.go
- api/marshaljson_variants_test.go
New test: api/unifiedenum_test.go covers ChatMemberStatus and
MessageOriginType: variant-field retype, direct comparison without
conversion, marshal discriminator preservation, full round-trip,
stutter-suffix Kind sanity check.
338 lines
13 KiB
Go
338 lines
13 KiB
Go
// Code generated by cmd/genapi. DO NOT EDIT.
|
|
|
|
//go:build !ignore_autogenerated
|
|
|
|
package api
|
|
|
|
type BackgroundFillType string
|
|
|
|
const (
|
|
BackgroundFillTypeSolid BackgroundFillType = "solid"
|
|
BackgroundFillTypeGradient BackgroundFillType = "gradient"
|
|
BackgroundFillTypeFreeformGradient BackgroundFillType = "freeform_gradient"
|
|
)
|
|
|
|
type BackgroundTypeKind string
|
|
|
|
const (
|
|
BackgroundTypeKindFill BackgroundTypeKind = "fill"
|
|
BackgroundTypeKindWallpaper BackgroundTypeKind = "wallpaper"
|
|
BackgroundTypeKindPattern BackgroundTypeKind = "pattern"
|
|
BackgroundTypeKindChatTheme BackgroundTypeKind = "chat_theme"
|
|
)
|
|
|
|
type ChatBoostSourceKind string
|
|
|
|
const (
|
|
ChatBoostSourceKindPremium ChatBoostSourceKind = "premium"
|
|
ChatBoostSourceKindGiftCode ChatBoostSourceKind = "gift_code"
|
|
ChatBoostSourceKindGiveaway ChatBoostSourceKind = "giveaway"
|
|
)
|
|
|
|
type ChatMemberStatus string
|
|
|
|
const (
|
|
ChatMemberStatusCreator ChatMemberStatus = "creator"
|
|
ChatMemberStatusAdministrator ChatMemberStatus = "administrator"
|
|
ChatMemberStatusMember ChatMemberStatus = "member"
|
|
ChatMemberStatusRestricted ChatMemberStatus = "restricted"
|
|
ChatMemberStatusLeft ChatMemberStatus = "left"
|
|
ChatMemberStatusKicked ChatMemberStatus = "kicked"
|
|
)
|
|
|
|
type ChatType string
|
|
|
|
const (
|
|
ChatTypePrivate ChatType = "private"
|
|
ChatTypeGroup ChatType = "group"
|
|
ChatTypeSupergroup ChatType = "supergroup"
|
|
ChatTypeChannel ChatType = "channel"
|
|
)
|
|
|
|
type EncryptedPassportElementType string
|
|
|
|
const (
|
|
EncryptedPassportElementTypePersonalDetails EncryptedPassportElementType = "personal_details"
|
|
EncryptedPassportElementTypePassport EncryptedPassportElementType = "passport"
|
|
EncryptedPassportElementTypeDriverLicense EncryptedPassportElementType = "driver_license"
|
|
EncryptedPassportElementTypeIdentityCard EncryptedPassportElementType = "identity_card"
|
|
EncryptedPassportElementTypeInternalPassport EncryptedPassportElementType = "internal_passport"
|
|
EncryptedPassportElementTypeAddress EncryptedPassportElementType = "address"
|
|
EncryptedPassportElementTypeUtilityBill EncryptedPassportElementType = "utility_bill"
|
|
EncryptedPassportElementTypeBankStatement EncryptedPassportElementType = "bank_statement"
|
|
EncryptedPassportElementTypeRentalAgreement EncryptedPassportElementType = "rental_agreement"
|
|
EncryptedPassportElementTypePassportRegistration EncryptedPassportElementType = "passport_registration"
|
|
EncryptedPassportElementTypeTemporaryRegistration EncryptedPassportElementType = "temporary_registration"
|
|
EncryptedPassportElementTypePhoneNumber EncryptedPassportElementType = "phone_number"
|
|
EncryptedPassportElementTypeEmail EncryptedPassportElementType = "email"
|
|
)
|
|
|
|
type InlineQueryChatType string
|
|
|
|
const (
|
|
InlineQueryChatTypeSender InlineQueryChatType = "sender"
|
|
InlineQueryChatTypePrivate InlineQueryChatType = "private"
|
|
InlineQueryChatTypeGroup InlineQueryChatType = "group"
|
|
InlineQueryChatTypeSupergroup InlineQueryChatType = "supergroup"
|
|
InlineQueryChatTypeChannel InlineQueryChatType = "channel"
|
|
)
|
|
|
|
type InlineQueryResultDocumentMimeType string
|
|
|
|
const (
|
|
InlineQueryResultDocumentMimeTypeApplicationOfPdf InlineQueryResultDocumentMimeType = "application/pdf"
|
|
InlineQueryResultDocumentMimeTypeApplicationOfZip InlineQueryResultDocumentMimeType = "application/zip"
|
|
)
|
|
|
|
type InlineQueryResultGifThumbnailMimeType string
|
|
|
|
const (
|
|
InlineQueryResultGifThumbnailMimeTypeImageOfJpeg InlineQueryResultGifThumbnailMimeType = "image/jpeg"
|
|
InlineQueryResultGifThumbnailMimeTypeImageOfGif InlineQueryResultGifThumbnailMimeType = "image/gif"
|
|
InlineQueryResultGifThumbnailMimeTypeVideoOfMp4 InlineQueryResultGifThumbnailMimeType = "video/mp4"
|
|
)
|
|
|
|
type InputStickerFormat string
|
|
|
|
const (
|
|
InputStickerFormatStatic InputStickerFormat = "static"
|
|
InputStickerFormatAnimated InputStickerFormat = "animated"
|
|
InputStickerFormatVideo InputStickerFormat = "video"
|
|
)
|
|
|
|
type KeyboardButtonStyle string
|
|
|
|
const (
|
|
KeyboardButtonStyleDanger KeyboardButtonStyle = "danger"
|
|
KeyboardButtonStyleSuccess KeyboardButtonStyle = "success"
|
|
KeyboardButtonStylePrimary KeyboardButtonStyle = "primary"
|
|
)
|
|
|
|
type MaskPositionPoint string
|
|
|
|
const (
|
|
MaskPositionPointForehead MaskPositionPoint = "forehead"
|
|
MaskPositionPointEyes MaskPositionPoint = "eyes"
|
|
MaskPositionPointMouth MaskPositionPoint = "mouth"
|
|
MaskPositionPointChin MaskPositionPoint = "chin"
|
|
)
|
|
|
|
type MessageEntityType string
|
|
|
|
const (
|
|
MessageEntityTypeMention MessageEntityType = "mention"
|
|
MessageEntityTypeHashtag MessageEntityType = "hashtag"
|
|
MessageEntityTypeCashtag MessageEntityType = "cashtag"
|
|
MessageEntityTypeBotCommand MessageEntityType = "bot_command"
|
|
MessageEntityTypeURL MessageEntityType = "url"
|
|
MessageEntityTypeEmail MessageEntityType = "email"
|
|
MessageEntityTypePhoneNumber MessageEntityType = "phone_number"
|
|
MessageEntityTypeBold MessageEntityType = "bold"
|
|
MessageEntityTypeItalic MessageEntityType = "italic"
|
|
MessageEntityTypeUnderline MessageEntityType = "underline"
|
|
MessageEntityTypeStrikethrough MessageEntityType = "strikethrough"
|
|
MessageEntityTypeSpoiler MessageEntityType = "spoiler"
|
|
MessageEntityTypeBlockquote MessageEntityType = "blockquote"
|
|
MessageEntityTypeExpandableBlockquote MessageEntityType = "expandable_blockquote"
|
|
MessageEntityTypeCode MessageEntityType = "code"
|
|
MessageEntityTypePre MessageEntityType = "pre"
|
|
MessageEntityTypeTextLink MessageEntityType = "text_link"
|
|
MessageEntityTypeTextMention MessageEntityType = "text_mention"
|
|
MessageEntityTypeCustomEmoji MessageEntityType = "custom_emoji"
|
|
MessageEntityTypeDateTime MessageEntityType = "date_time"
|
|
)
|
|
|
|
type MessageOriginType string
|
|
|
|
const (
|
|
MessageOriginTypeUser MessageOriginType = "user"
|
|
MessageOriginTypeHiddenUser MessageOriginType = "hidden_user"
|
|
MessageOriginTypeChat MessageOriginType = "chat"
|
|
MessageOriginTypeChannel MessageOriginType = "channel"
|
|
)
|
|
|
|
type OwnedGiftType string
|
|
|
|
const (
|
|
OwnedGiftTypeRegular OwnedGiftType = "regular"
|
|
OwnedGiftTypeUnique OwnedGiftType = "unique"
|
|
)
|
|
|
|
type PaidMediaType string
|
|
|
|
const (
|
|
PaidMediaTypeLivePhoto PaidMediaType = "live_photo"
|
|
PaidMediaTypePhoto PaidMediaType = "photo"
|
|
PaidMediaTypePreview PaidMediaType = "preview"
|
|
PaidMediaTypeVideo PaidMediaType = "video"
|
|
)
|
|
|
|
type ParseMode string
|
|
|
|
const (
|
|
ParseModeMarkdown ParseMode = "Markdown"
|
|
ParseModeMarkdownV2 ParseMode = "MarkdownV2"
|
|
ParseModeHTML ParseMode = "HTML"
|
|
)
|
|
|
|
type PassportElementErrorDataFieldType string
|
|
|
|
const (
|
|
PassportElementErrorDataFieldTypePersonalDetails PassportElementErrorDataFieldType = "personal_details"
|
|
PassportElementErrorDataFieldTypePassport PassportElementErrorDataFieldType = "passport"
|
|
PassportElementErrorDataFieldTypeDriverLicense PassportElementErrorDataFieldType = "driver_license"
|
|
PassportElementErrorDataFieldTypeIdentityCard PassportElementErrorDataFieldType = "identity_card"
|
|
PassportElementErrorDataFieldTypeInternalPassport PassportElementErrorDataFieldType = "internal_passport"
|
|
PassportElementErrorDataFieldTypeAddress PassportElementErrorDataFieldType = "address"
|
|
)
|
|
|
|
type PassportElementErrorFileType string
|
|
|
|
const (
|
|
PassportElementErrorFileTypeUtilityBill PassportElementErrorFileType = "utility_bill"
|
|
PassportElementErrorFileTypeBankStatement PassportElementErrorFileType = "bank_statement"
|
|
PassportElementErrorFileTypeRentalAgreement PassportElementErrorFileType = "rental_agreement"
|
|
PassportElementErrorFileTypePassportRegistration PassportElementErrorFileType = "passport_registration"
|
|
PassportElementErrorFileTypeTemporaryRegistration PassportElementErrorFileType = "temporary_registration"
|
|
)
|
|
|
|
type PassportElementErrorReverseSideType string
|
|
|
|
const (
|
|
PassportElementErrorReverseSideTypeDriverLicense PassportElementErrorReverseSideType = "driver_license"
|
|
PassportElementErrorReverseSideTypeIdentityCard PassportElementErrorReverseSideType = "identity_card"
|
|
)
|
|
|
|
type PassportElementErrorSelfieType string
|
|
|
|
const (
|
|
PassportElementErrorSelfieTypePassport PassportElementErrorSelfieType = "passport"
|
|
PassportElementErrorSelfieTypeDriverLicense PassportElementErrorSelfieType = "driver_license"
|
|
PassportElementErrorSelfieTypeIdentityCard PassportElementErrorSelfieType = "identity_card"
|
|
PassportElementErrorSelfieTypeInternalPassport PassportElementErrorSelfieType = "internal_passport"
|
|
)
|
|
|
|
type PassportElementErrorTranslationFileType string
|
|
|
|
const (
|
|
PassportElementErrorTranslationFileTypePassport PassportElementErrorTranslationFileType = "passport"
|
|
PassportElementErrorTranslationFileTypeDriverLicense PassportElementErrorTranslationFileType = "driver_license"
|
|
PassportElementErrorTranslationFileTypeIdentityCard PassportElementErrorTranslationFileType = "identity_card"
|
|
PassportElementErrorTranslationFileTypeInternalPassport PassportElementErrorTranslationFileType = "internal_passport"
|
|
PassportElementErrorTranslationFileTypeUtilityBill PassportElementErrorTranslationFileType = "utility_bill"
|
|
PassportElementErrorTranslationFileTypeBankStatement PassportElementErrorTranslationFileType = "bank_statement"
|
|
PassportElementErrorTranslationFileTypeRentalAgreement PassportElementErrorTranslationFileType = "rental_agreement"
|
|
PassportElementErrorTranslationFileTypePassportRegistration PassportElementErrorTranslationFileType = "passport_registration"
|
|
PassportElementErrorTranslationFileTypeTemporaryRegistration PassportElementErrorTranslationFileType = "temporary_registration"
|
|
)
|
|
|
|
type PollType string
|
|
|
|
const (
|
|
PollTypeRegular PollType = "regular"
|
|
PollTypeQuiz PollType = "quiz"
|
|
)
|
|
|
|
type ReactionTypeKind string
|
|
|
|
const (
|
|
ReactionTypeKindEmoji ReactionTypeKind = "emoji"
|
|
ReactionTypeKindCustomEmoji ReactionTypeKind = "custom_emoji"
|
|
ReactionTypeKindPaid ReactionTypeKind = "paid"
|
|
)
|
|
|
|
type RefundedPaymentCurrency string
|
|
|
|
const (
|
|
RefundedPaymentCurrencyXTR RefundedPaymentCurrency = "XTR"
|
|
)
|
|
|
|
type RevenueWithdrawalStateKind string
|
|
|
|
const (
|
|
RevenueWithdrawalStateKindPending RevenueWithdrawalStateKind = "pending"
|
|
RevenueWithdrawalStateKindSucceeded RevenueWithdrawalStateKind = "succeeded"
|
|
RevenueWithdrawalStateKindFailed RevenueWithdrawalStateKind = "failed"
|
|
)
|
|
|
|
type StickerType string
|
|
|
|
const (
|
|
StickerTypeRegular StickerType = "regular"
|
|
StickerTypeMask StickerType = "mask"
|
|
StickerTypeCustomEmoji StickerType = "custom_emoji"
|
|
)
|
|
|
|
type StoryAreaTypeKind string
|
|
|
|
const (
|
|
StoryAreaTypeKindLocation StoryAreaTypeKind = "location"
|
|
StoryAreaTypeKindSuggestedReaction StoryAreaTypeKind = "suggested_reaction"
|
|
StoryAreaTypeKindLink StoryAreaTypeKind = "link"
|
|
StoryAreaTypeKindWeather StoryAreaTypeKind = "weather"
|
|
StoryAreaTypeKindUniqueGift StoryAreaTypeKind = "unique_gift"
|
|
)
|
|
|
|
type SuggestedPostInfoState string
|
|
|
|
const (
|
|
SuggestedPostInfoStatePending SuggestedPostInfoState = "pending"
|
|
SuggestedPostInfoStateApproved SuggestedPostInfoState = "approved"
|
|
SuggestedPostInfoStateDeclined SuggestedPostInfoState = "declined"
|
|
)
|
|
|
|
type SuggestedPostPaidCurrency string
|
|
|
|
const (
|
|
SuggestedPostPaidCurrencyXTR SuggestedPostPaidCurrency = "XTR"
|
|
SuggestedPostPaidCurrencyTON SuggestedPostPaidCurrency = "TON"
|
|
)
|
|
|
|
type SuggestedPostRefundedReason string
|
|
|
|
const (
|
|
SuggestedPostRefundedReasonPostDeleted SuggestedPostRefundedReason = "post_deleted"
|
|
SuggestedPostRefundedReasonPaymentRefunded SuggestedPostRefundedReason = "payment_refunded"
|
|
)
|
|
|
|
type TransactionPartnerType string
|
|
|
|
const (
|
|
TransactionPartnerTypeUser TransactionPartnerType = "user"
|
|
TransactionPartnerTypeChat TransactionPartnerType = "chat"
|
|
TransactionPartnerTypeAffiliateProgram TransactionPartnerType = "affiliate_program"
|
|
TransactionPartnerTypeFragment TransactionPartnerType = "fragment"
|
|
TransactionPartnerTypeTelegramAds TransactionPartnerType = "telegram_ads"
|
|
TransactionPartnerTypeTelegramApi TransactionPartnerType = "telegram_api"
|
|
TransactionPartnerTypeOther TransactionPartnerType = "other"
|
|
)
|
|
|
|
type TransactionPartnerUserTransactionType string
|
|
|
|
const (
|
|
TransactionPartnerUserTransactionTypeInvoicePayment TransactionPartnerUserTransactionType = "invoice_payment"
|
|
TransactionPartnerUserTransactionTypePaidMediaPayment TransactionPartnerUserTransactionType = "paid_media_payment"
|
|
TransactionPartnerUserTransactionTypeGiftPurchase TransactionPartnerUserTransactionType = "gift_purchase"
|
|
TransactionPartnerUserTransactionTypePremiumPurchase TransactionPartnerUserTransactionType = "premium_purchase"
|
|
TransactionPartnerUserTransactionTypeBusinessAccountTransfer TransactionPartnerUserTransactionType = "business_account_transfer"
|
|
)
|
|
|
|
type UniqueGiftInfoOrigin string
|
|
|
|
const (
|
|
UniqueGiftInfoOriginUpgrade UniqueGiftInfoOrigin = "upgrade"
|
|
UniqueGiftInfoOriginTransfer UniqueGiftInfoOrigin = "transfer"
|
|
UniqueGiftInfoOriginResale UniqueGiftInfoOrigin = "resale"
|
|
UniqueGiftInfoOriginGiftedUpgrade UniqueGiftInfoOrigin = "gifted_upgrade"
|
|
UniqueGiftInfoOriginOffer UniqueGiftInfoOrigin = "offer"
|
|
)
|
|
|
|
type UniqueGiftModelRarity string
|
|
|
|
const (
|
|
UniqueGiftModelRarityUncommon UniqueGiftModelRarity = "uncommon"
|
|
UniqueGiftModelRarityRare UniqueGiftModelRarity = "rare"
|
|
UniqueGiftModelRarityEpic UniqueGiftModelRarity = "epic"
|
|
UniqueGiftModelRarityLegendary UniqueGiftModelRarity = "legendary"
|
|
)
|