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.
API Reference
Auto-generated from Go source comments by gomarkdoc. Do not edit by hand — run make docs to regenerate.
Packages
| Package | Description |
|---|---|
api |
Telegram Bot API types and method wrappers — 176 methods, 301 types, fully generated |
client |
Bot client, codec, HTTP doer, retry middleware |
transport |
Long-poll and webhook transports |
dispatch |
Update router, filters, handler groups, named handlers |
dispatch/conversation |
Multi-step conversation state machines |
dispatch/filters/message |
Message filters — Command, Text, IsReply, etc. |
dispatch/filters/callback |
Callback query filters |
dispatch/filters/inline |
Inline query filters |
dispatch/filters/chatmember |
Chat member update filters |
dispatch/filters/chatjoinrequest |
Join request filters |
dispatch/filters/precheckoutquery |
Pre-checkout filters for payments |
Also see
- Project home — landing page with examples and overview
- GitHub repository
- pkg.go.dev — official Go package documentation