diff --git a/api/marshaljson_variants_test.go b/api/marshaljson_variants_test.go new file mode 100644 index 0000000..a7cb06c --- /dev/null +++ b/api/marshaljson_variants_test.go @@ -0,0 +1,103 @@ +package api + +import ( + "testing" + + json "github.com/goccy/go-json" + "github.com/stretchr/testify/require" +) + +// TestMarshalJSON_TypeDiscriminator_AutoInjected verifies the generated +// MarshalJSON hardcodes the wire discriminator for a Type-keyed variant +// even when the caller leaves the field zero. +func TestMarshalJSON_TypeDiscriminator_AutoInjected(t *testing.T) { + scope := &BotCommandScopeAllPrivateChats{} + got, err := json.Marshal(scope) + require.NoError(t, err) + require.JSONEq(t, `{"type":"all_private_chats"}`, string(got)) +} + +// TestMarshalJSON_SourceDiscriminator_AutoInjected verifies the same +// for variants that use a non-Type discriminator field. PassportElement +// errors key on "source" instead. +func TestMarshalJSON_SourceDiscriminator_AutoInjected(t *testing.T) { + err := &PassportElementErrorDataField{ + Type: PassportElementErrorDataFieldTypePersonalDetails, + FieldName: "first_name", + DataHash: "abc123", + Message: "bad data", + } + got, mErr := json.Marshal(err) + require.NoError(t, mErr) + require.JSONEq(t, + `{"source":"data","type":"personal_details","field_name":"first_name","data_hash":"abc123","message":"bad data"}`, + string(got), + ) +} + +// TestMarshalJSON_UserSuppliedDiscriminator_Overridden documents the +// safety guarantee: a typo or stale value the caller pastes into the +// struct literal is silently overridden by the generated MarshalJSON. +// This is what saves callers from Telegram's "silent reject" failure +// mode when a discriminator is wrong. +func TestMarshalJSON_UserSuppliedDiscriminator_Overridden(t *testing.T) { + scope := &BotCommandScopeAllPrivateChats{Type: "wrong"} + got, err := json.Marshal(scope) + require.NoError(t, err) + require.JSONEq(t, `{"type":"all_private_chats"}`, string(got)) +} + +// TestMarshalJSON_RoundTrip confirms a marshal-then-unmarshal cycle +// preserves user-supplied fields. Discriminator field is set on the +// way out, read back on the way in — no data loss. +// +// Uses ChatMember (one of the auto-decode unions) so the round-trip +// can route through the generated UnmarshalChatMember dispatcher. +func TestMarshalJSON_RoundTrip(t *testing.T) { + orig := &ChatMemberLeft{ + User: User{ID: 42, IsBot: false, FirstName: "alice"}, + } + raw, err := json.Marshal(orig) + require.NoError(t, err) + + out, err := UnmarshalChatMember(raw) + require.NoError(t, err) + + round, ok := out.(*ChatMemberLeft) + require.True(t, ok, "expected *ChatMemberLeft, got %T", out) + require.Equal(t, ChatMemberLeftStatusLeft, round.Status) + require.Equal(t, orig.User.ID, round.User.ID) + require.Equal(t, orig.User.FirstName, round.User.FirstName) +} + +// TestMarshalJSON_InputMessageContent_NoDiscriminator confirms that +// variants of InputMessageContent (the structurally-dispatched union +// Telegram identifies by field presence, not by a "type" field) do +// NOT get an injected discriminator. Their fields ride out as-is. +func TestMarshalJSON_InputMessageContent_NoDiscriminator(t *testing.T) { + content := &InputTextMessageContent{ + MessageText: "hello world", + } + got, err := json.Marshal(content) + require.NoError(t, err) + // No "type" field should appear; just message_text. + require.JSONEq(t, `{"message_text":"hello world"}`, string(got)) +} + +// TestMarshalJSON_NonDiscriminatorMembers_RidealongUnchanged verifies +// the alias-embedding pattern: every non-discriminator field on the +// variant marshals through the *alias and keeps its own json tag and +// omitempty behaviour. Caption + ParseMode here exercise both +// required-string-with-discriminator and optional-with-omitempty. +func TestMarshalJSON_NonDiscriminatorMembers_RidealongUnchanged(t *testing.T) { + media := &InputMediaPhoto{ + Media: "https://example.com/photo.jpg", + Caption: "look", + } + got, err := json.Marshal(media) + require.NoError(t, err) + require.JSONEq(t, + `{"type":"photo","media":"https://example.com/photo.jpg","caption":"look"}`, + string(got), + ) +} diff --git a/api/types.gen.go b/api/types.gen.go index 71efc08..f4f69d2 100644 --- a/api/types.gen.go +++ b/api/types.gen.go @@ -807,6 +807,22 @@ type MessageOriginUser struct { SenderUser User `json:"sender_user"` } +// MarshalJSON encodes MessageOriginUser with the discriminator field +// "type" forced to "user". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MessageOriginUser) MarshalJSON() ([]byte, error) { + type alias MessageOriginUser + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "user", + alias: (*alias)(v), + }) +} + // The message was originally sent by an unknown user. type MessageOriginHiddenUser struct { // Type of the message origin, always “hidden_user” @@ -817,6 +833,22 @@ type MessageOriginHiddenUser struct { SenderUserName string `json:"sender_user_name"` } +// MarshalJSON encodes MessageOriginHiddenUser with the discriminator field +// "type" forced to "hidden_user". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MessageOriginHiddenUser) MarshalJSON() ([]byte, error) { + type alias MessageOriginHiddenUser + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "hidden_user", + alias: (*alias)(v), + }) +} + // The message was originally sent on behalf of a chat to a group chat. type MessageOriginChat struct { // Type of the message origin, always “chat” @@ -829,6 +861,22 @@ type MessageOriginChat struct { AuthorSignature string `json:"author_signature,omitempty"` } +// MarshalJSON encodes MessageOriginChat with the discriminator field +// "type" forced to "chat". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MessageOriginChat) MarshalJSON() ([]byte, error) { + type alias MessageOriginChat + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "chat", + alias: (*alias)(v), + }) +} + // The message was originally sent to a channel chat. type MessageOriginChannel struct { // Type of the message origin, always “channel” @@ -843,6 +891,22 @@ type MessageOriginChannel struct { AuthorSignature string `json:"author_signature,omitempty"` } +// MarshalJSON encodes MessageOriginChannel with the discriminator field +// "type" forced to "channel". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MessageOriginChannel) MarshalJSON() ([]byte, error) { + type alias MessageOriginChannel + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "channel", + alias: (*alias)(v), + }) +} + // This object represents one size of a photo or a file / sticker thumbnail. type PhotoSize struct { // Identifier for this file, which can be used to download or reuse the file @@ -1115,6 +1179,22 @@ type PaidMediaLivePhoto struct { LivePhoto LivePhoto `json:"live_photo"` } +// MarshalJSON encodes PaidMediaLivePhoto with the discriminator field +// "type" forced to "live_photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PaidMediaLivePhoto) MarshalJSON() ([]byte, error) { + type alias PaidMediaLivePhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "live_photo", + alias: (*alias)(v), + }) +} + // The paid media is a photo. type PaidMediaPhoto struct { // Type of the paid media, always “photo” @@ -1123,6 +1203,22 @@ type PaidMediaPhoto struct { Photo []PhotoSize `json:"photo"` } +// MarshalJSON encodes PaidMediaPhoto with the discriminator field +// "type" forced to "photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PaidMediaPhoto) MarshalJSON() ([]byte, error) { + type alias PaidMediaPhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "photo", + alias: (*alias)(v), + }) +} + // The paid media isn't available before the payment. type PaidMediaPreview struct { // Type of the paid media, always “preview” @@ -1135,6 +1231,22 @@ type PaidMediaPreview struct { Duration *int64 `json:"duration,omitempty"` } +// MarshalJSON encodes PaidMediaPreview with the discriminator field +// "type" forced to "preview". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PaidMediaPreview) MarshalJSON() ([]byte, error) { + type alias PaidMediaPreview + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "preview", + alias: (*alias)(v), + }) +} + // The paid media is a video. type PaidMediaVideo struct { // Type of the paid media, always “video” @@ -1143,6 +1255,22 @@ type PaidMediaVideo struct { Video Video `json:"video"` } +// MarshalJSON encodes PaidMediaVideo with the discriminator field +// "type" forced to "video". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PaidMediaVideo) MarshalJSON() ([]byte, error) { + type alias PaidMediaVideo + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "video", + alias: (*alias)(v), + }) +} + // This object represents a phone contact. type Contact struct { // Contact's phone number @@ -1629,6 +1757,22 @@ type BackgroundFillSolid struct { Color int64 `json:"color"` } +// MarshalJSON encodes BackgroundFillSolid with the discriminator field +// "type" forced to "solid". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundFillSolid) MarshalJSON() ([]byte, error) { + type alias BackgroundFillSolid + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "solid", + alias: (*alias)(v), + }) +} + // The background is a gradient fill. type BackgroundFillGradient struct { // Type of the background fill, always “gradient” @@ -1641,6 +1785,22 @@ type BackgroundFillGradient struct { RotationAngle int64 `json:"rotation_angle"` } +// MarshalJSON encodes BackgroundFillGradient with the discriminator field +// "type" forced to "gradient". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundFillGradient) MarshalJSON() ([]byte, error) { + type alias BackgroundFillGradient + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "gradient", + alias: (*alias)(v), + }) +} + // The background is a freeform gradient that rotates after every message in the chat. type BackgroundFillFreeformGradient struct { // Type of the background fill, always “freeform_gradient” @@ -1649,6 +1809,22 @@ type BackgroundFillFreeformGradient struct { Colors []int64 `json:"colors"` } +// MarshalJSON encodes BackgroundFillFreeformGradient with the discriminator field +// "type" forced to "freeform_gradient". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundFillFreeformGradient) MarshalJSON() ([]byte, error) { + type alias BackgroundFillFreeformGradient + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "freeform_gradient", + alias: (*alias)(v), + }) +} + // BackgroundType is a union type. The following concrete variants implement // it: // - BackgroundTypeFill @@ -1709,6 +1885,22 @@ type BackgroundTypeFill struct { DarkThemeDimming int64 `json:"dark_theme_dimming"` } +// MarshalJSON encodes BackgroundTypeFill with the discriminator field +// "type" forced to "fill". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundTypeFill) MarshalJSON() ([]byte, error) { + type alias BackgroundTypeFill + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "fill", + alias: (*alias)(v), + }) +} + // UnmarshalJSON decodes BackgroundTypeFill by dispatching union-typed fields // (Fill) through their concrete UnmarshalXxx helpers. func (m *BackgroundTypeFill) UnmarshalJSON(data []byte) error { @@ -1747,6 +1939,22 @@ type BackgroundTypeWallpaper struct { IsMoving *bool `json:"is_moving,omitempty"` } +// MarshalJSON encodes BackgroundTypeWallpaper with the discriminator field +// "type" forced to "wallpaper". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundTypeWallpaper) MarshalJSON() ([]byte, error) { + type alias BackgroundTypeWallpaper + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "wallpaper", + alias: (*alias)(v), + }) +} + // The background is a .PNG or .TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user. type BackgroundTypePattern struct { // Type of the background, always “pattern” @@ -1763,6 +1971,22 @@ type BackgroundTypePattern struct { IsMoving *bool `json:"is_moving,omitempty"` } +// MarshalJSON encodes BackgroundTypePattern with the discriminator field +// "type" forced to "pattern". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundTypePattern) MarshalJSON() ([]byte, error) { + type alias BackgroundTypePattern + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "pattern", + alias: (*alias)(v), + }) +} + // UnmarshalJSON decodes BackgroundTypePattern by dispatching union-typed fields // (Fill) through their concrete UnmarshalXxx helpers. func (m *BackgroundTypePattern) UnmarshalJSON(data []byte) error { @@ -1795,6 +2019,22 @@ type BackgroundTypeChatTheme struct { ThemeName string `json:"theme_name"` } +// MarshalJSON encodes BackgroundTypeChatTheme with the discriminator field +// "type" forced to "chat_theme". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BackgroundTypeChatTheme) MarshalJSON() ([]byte, error) { + type alias BackgroundTypeChatTheme + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "chat_theme", + alias: (*alias)(v), + }) +} + // This object represents a chat background. type ChatBackground struct { // Type of the background @@ -2577,6 +2817,22 @@ type ChatMemberOwner struct { CustomTitle string `json:"custom_title,omitempty"` } +// MarshalJSON encodes ChatMemberOwner with the discriminator field +// "status" forced to "creator". +// The hardcoded value frees callers from setting Status by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatMemberOwner) MarshalJSON() ([]byte, error) { + type alias ChatMemberOwner + return json.Marshal(&struct { + Status string `json:"status"` + *alias + }{ + Status: "creator", + alias: (*alias)(v), + }) +} + // Represents a chat member that has some additional privileges. type ChatMemberAdministrator struct { // The member's status in the chat, always “administrator” @@ -2623,6 +2879,22 @@ type ChatMemberAdministrator struct { CustomTitle string `json:"custom_title,omitempty"` } +// MarshalJSON encodes ChatMemberAdministrator with the discriminator field +// "status" forced to "administrator". +// The hardcoded value frees callers from setting Status by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatMemberAdministrator) MarshalJSON() ([]byte, error) { + type alias ChatMemberAdministrator + return json.Marshal(&struct { + Status string `json:"status"` + *alias + }{ + Status: "administrator", + alias: (*alias)(v), + }) +} + // Represents a chat member that has no additional privileges or restrictions. type ChatMemberMember struct { // The member's status in the chat, always “member” @@ -2635,6 +2907,22 @@ type ChatMemberMember struct { UntilDate *int64 `json:"until_date,omitempty"` } +// MarshalJSON encodes ChatMemberMember with the discriminator field +// "status" forced to "member". +// The hardcoded value frees callers from setting Status by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatMemberMember) MarshalJSON() ([]byte, error) { + type alias ChatMemberMember + return json.Marshal(&struct { + Status string `json:"status"` + *alias + }{ + Status: "member", + alias: (*alias)(v), + }) +} + // Represents a chat member that is under certain restrictions in the chat. Supergroups only. type ChatMemberRestricted struct { // The member's status in the chat, always “restricted” @@ -2681,6 +2969,22 @@ type ChatMemberRestricted struct { UntilDate int64 `json:"until_date"` } +// MarshalJSON encodes ChatMemberRestricted with the discriminator field +// "status" forced to "restricted". +// The hardcoded value frees callers from setting Status by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatMemberRestricted) MarshalJSON() ([]byte, error) { + type alias ChatMemberRestricted + return json.Marshal(&struct { + Status string `json:"status"` + *alias + }{ + Status: "restricted", + alias: (*alias)(v), + }) +} + // Represents a chat member that isn't currently a member of the chat, but may join it themselves. type ChatMemberLeft struct { // The member's status in the chat, always “left” @@ -2689,6 +2993,22 @@ type ChatMemberLeft struct { User User `json:"user"` } +// MarshalJSON encodes ChatMemberLeft with the discriminator field +// "status" forced to "left". +// The hardcoded value frees callers from setting Status by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatMemberLeft) MarshalJSON() ([]byte, error) { + type alias ChatMemberLeft + return json.Marshal(&struct { + Status string `json:"status"` + *alias + }{ + Status: "left", + alias: (*alias)(v), + }) +} + // Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. type ChatMemberBanned struct { // The member's status in the chat, always “kicked” @@ -2699,6 +3019,22 @@ type ChatMemberBanned struct { UntilDate int64 `json:"until_date"` } +// MarshalJSON encodes ChatMemberBanned with the discriminator field +// "status" forced to "kicked". +// The hardcoded value frees callers from setting Status by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatMemberBanned) MarshalJSON() ([]byte, error) { + type alias ChatMemberBanned + return json.Marshal(&struct { + Status string `json:"status"` + *alias + }{ + Status: "kicked", + alias: (*alias)(v), + }) +} + // Represents a join request sent to a chat. type ChatJoinRequest struct { // Chat to which the request was sent @@ -2903,6 +3239,22 @@ type StoryAreaTypeLocation struct { Address *LocationAddress `json:"address,omitempty"` } +// MarshalJSON encodes StoryAreaTypeLocation with the discriminator field +// "type" forced to "location". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { + type alias StoryAreaTypeLocation + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "location", + alias: (*alias)(v), + }) +} + // Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas. type StoryAreaTypeSuggestedReaction struct { // Type of the area, always “suggested_reaction” @@ -2915,6 +3267,22 @@ type StoryAreaTypeSuggestedReaction struct { IsFlipped *bool `json:"is_flipped,omitempty"` } +// MarshalJSON encodes StoryAreaTypeSuggestedReaction with the discriminator field +// "type" forced to "suggested_reaction". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *StoryAreaTypeSuggestedReaction) MarshalJSON() ([]byte, error) { + type alias StoryAreaTypeSuggestedReaction + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "suggested_reaction", + alias: (*alias)(v), + }) +} + // UnmarshalJSON decodes StoryAreaTypeSuggestedReaction by dispatching union-typed fields // (ReactionType) through their concrete UnmarshalXxx helpers. func (m *StoryAreaTypeSuggestedReaction) UnmarshalJSON(data []byte) error { @@ -2947,6 +3315,22 @@ type StoryAreaTypeLink struct { URL string `json:"url"` } +// MarshalJSON encodes StoryAreaTypeLink with the discriminator field +// "type" forced to "link". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *StoryAreaTypeLink) MarshalJSON() ([]byte, error) { + type alias StoryAreaTypeLink + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "link", + alias: (*alias)(v), + }) +} + // Describes a story area containing weather information. Currently, a story can have up to 3 weather areas. type StoryAreaTypeWeather struct { // Type of the area, always “weather” @@ -2959,6 +3343,22 @@ type StoryAreaTypeWeather struct { BackgroundColor int64 `json:"background_color"` } +// MarshalJSON encodes StoryAreaTypeWeather with the discriminator field +// "type" forced to "weather". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *StoryAreaTypeWeather) MarshalJSON() ([]byte, error) { + type alias StoryAreaTypeWeather + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "weather", + alias: (*alias)(v), + }) +} + // Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area. type StoryAreaTypeUniqueGift struct { // Type of the area, always “unique_gift” @@ -2967,6 +3367,22 @@ type StoryAreaTypeUniqueGift struct { Name string `json:"name"` } +// MarshalJSON encodes StoryAreaTypeUniqueGift with the discriminator field +// "type" forced to "unique_gift". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *StoryAreaTypeUniqueGift) MarshalJSON() ([]byte, error) { + type alias StoryAreaTypeUniqueGift + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "unique_gift", + alias: (*alias)(v), + }) +} + // Describes a clickable area on a story media. type StoryArea struct { // Position of the area @@ -3059,6 +3475,22 @@ type ReactionTypeEmoji struct { Emoji string `json:"emoji"` } +// MarshalJSON encodes ReactionTypeEmoji with the discriminator field +// "type" forced to "emoji". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ReactionTypeEmoji) MarshalJSON() ([]byte, error) { + type alias ReactionTypeEmoji + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "emoji", + alias: (*alias)(v), + }) +} + // The reaction is based on a custom emoji. type ReactionTypeCustomEmoji struct { // Type of the reaction, always “custom_emoji” @@ -3067,12 +3499,44 @@ type ReactionTypeCustomEmoji struct { CustomEmojiID string `json:"custom_emoji_id"` } +// MarshalJSON encodes ReactionTypeCustomEmoji with the discriminator field +// "type" forced to "custom_emoji". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ReactionTypeCustomEmoji) MarshalJSON() ([]byte, error) { + type alias ReactionTypeCustomEmoji + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "custom_emoji", + alias: (*alias)(v), + }) +} + // The reaction is paid. type ReactionTypePaid struct { // Type of the reaction, always “paid” Type ReactionTypePaidType `json:"type"` } +// MarshalJSON encodes ReactionTypePaid with the discriminator field +// "type" forced to "paid". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ReactionTypePaid) MarshalJSON() ([]byte, error) { + type alias ReactionTypePaid + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "paid", + alias: (*alias)(v), + }) +} + // Represents a reaction added to a message along with the number of times it was added. type ReactionCount struct { // Type of the reaction @@ -3447,6 +3911,22 @@ type OwnedGiftRegular struct { UniqueGiftNumber *int64 `json:"unique_gift_number,omitempty"` } +// MarshalJSON encodes OwnedGiftRegular with the discriminator field +// "type" forced to "regular". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *OwnedGiftRegular) MarshalJSON() ([]byte, error) { + type alias OwnedGiftRegular + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "regular", + alias: (*alias)(v), + }) +} + // Describes a unique gift received and owned by a user or a chat. type OwnedGiftUnique struct { // Type of the gift, always “unique” @@ -3469,6 +3949,22 @@ type OwnedGiftUnique struct { NextTransferDate *int64 `json:"next_transfer_date,omitempty"` } +// MarshalJSON encodes OwnedGiftUnique with the discriminator field +// "type" forced to "unique". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *OwnedGiftUnique) MarshalJSON() ([]byte, error) { + type alias OwnedGiftUnique + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "unique", + alias: (*alias)(v), + }) +} + // Contains the list of gifts received and owned by a user or a chat. type OwnedGifts struct { // The total number of gifts owned by the user or the chat @@ -3589,24 +4085,88 @@ type BotCommandScopeDefault struct { Type string `json:"type"` } +// MarshalJSON encodes BotCommandScopeDefault with the discriminator field +// "type" forced to "default". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeDefault) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeDefault + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "default", + alias: (*alias)(v), + }) +} + // Represents the scope of bot commands, covering all private chats. type BotCommandScopeAllPrivateChats struct { // Scope type, must be all_private_chats Type string `json:"type"` } +// MarshalJSON encodes BotCommandScopeAllPrivateChats with the discriminator field +// "type" forced to "all_private_chats". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeAllPrivateChats) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeAllPrivateChats + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "all_private_chats", + alias: (*alias)(v), + }) +} + // Represents the scope of bot commands, covering all group and supergroup chats. type BotCommandScopeAllGroupChats struct { // Scope type, must be all_group_chats Type string `json:"type"` } +// MarshalJSON encodes BotCommandScopeAllGroupChats with the discriminator field +// "type" forced to "all_group_chats". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeAllGroupChats) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeAllGroupChats + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "all_group_chats", + alias: (*alias)(v), + }) +} + // Represents the scope of bot commands, covering all group and supergroup chat administrators. type BotCommandScopeAllChatAdministrators struct { // Scope type, must be all_chat_administrators Type string `json:"type"` } +// MarshalJSON encodes BotCommandScopeAllChatAdministrators with the discriminator field +// "type" forced to "all_chat_administrators". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeAllChatAdministrators) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeAllChatAdministrators + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "all_chat_administrators", + alias: (*alias)(v), + }) +} + // Represents the scope of bot commands, covering a specific chat. type BotCommandScopeChat struct { // Scope type, must be chat @@ -3615,6 +4175,22 @@ type BotCommandScopeChat struct { ChatID ChatID `json:"chat_id"` } +// MarshalJSON encodes BotCommandScopeChat with the discriminator field +// "type" forced to "chat". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeChat) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeChat + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "chat", + alias: (*alias)(v), + }) +} + // Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. type BotCommandScopeChatAdministrators struct { // Scope type, must be chat_administrators @@ -3623,6 +4199,22 @@ type BotCommandScopeChatAdministrators struct { ChatID ChatID `json:"chat_id"` } +// MarshalJSON encodes BotCommandScopeChatAdministrators with the discriminator field +// "type" forced to "chat_administrators". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeChatAdministrators) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeChatAdministrators + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "chat_administrators", + alias: (*alias)(v), + }) +} + // Represents the scope of bot commands, covering a specific member of a group or supergroup chat. type BotCommandScopeChatMember struct { // Scope type, must be chat_member @@ -3633,6 +4225,22 @@ type BotCommandScopeChatMember struct { UserID int64 `json:"user_id"` } +// MarshalJSON encodes BotCommandScopeChatMember with the discriminator field +// "type" forced to "chat_member". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *BotCommandScopeChatMember) MarshalJSON() ([]byte, error) { + type alias BotCommandScopeChatMember + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "chat_member", + alias: (*alias)(v), + }) +} + // This object represents the bot's name. type BotName struct { // The bot's name @@ -3702,6 +4310,22 @@ type MenuButtonCommands struct { Type string `json:"type"` } +// MarshalJSON encodes MenuButtonCommands with the discriminator field +// "type" forced to "commands". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MenuButtonCommands) MarshalJSON() ([]byte, error) { + type alias MenuButtonCommands + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "commands", + alias: (*alias)(v), + }) +} + // Represents a menu button, which launches a Web App. type MenuButtonWebApp struct { // Type of the button, must be web_app @@ -3712,12 +4336,44 @@ type MenuButtonWebApp struct { WebApp WebAppInfo `json:"web_app"` } +// MarshalJSON encodes MenuButtonWebApp with the discriminator field +// "type" forced to "web_app". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MenuButtonWebApp) MarshalJSON() ([]byte, error) { + type alias MenuButtonWebApp + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "web_app", + alias: (*alias)(v), + }) +} + // Describes that no specific value for the menu button was set. type MenuButtonDefault struct { // Type of the button, must be default Type string `json:"type"` } +// MarshalJSON encodes MenuButtonDefault with the discriminator field +// "type" forced to "default". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *MenuButtonDefault) MarshalJSON() ([]byte, error) { + type alias MenuButtonDefault + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "default", + alias: (*alias)(v), + }) +} + // ChatBoostSource is a union type. The following concrete variants implement // it: // - ChatBoostSourcePremium @@ -3770,6 +4426,22 @@ type ChatBoostSourcePremium struct { User User `json:"user"` } +// MarshalJSON encodes ChatBoostSourcePremium with the discriminator field +// "source" forced to "premium". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatBoostSourcePremium) MarshalJSON() ([]byte, error) { + type alias ChatBoostSourcePremium + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "premium", + alias: (*alias)(v), + }) +} + // The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. type ChatBoostSourceGiftCode struct { // Source of the boost, always “gift_code” @@ -3778,6 +4450,22 @@ type ChatBoostSourceGiftCode struct { User User `json:"user"` } +// MarshalJSON encodes ChatBoostSourceGiftCode with the discriminator field +// "source" forced to "gift_code". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatBoostSourceGiftCode) MarshalJSON() ([]byte, error) { + type alias ChatBoostSourceGiftCode + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "gift_code", + alias: (*alias)(v), + }) +} + // The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways. type ChatBoostSourceGiveaway struct { // Source of the boost, always “giveaway” @@ -3792,6 +4480,22 @@ type ChatBoostSourceGiveaway struct { IsUnclaimed *bool `json:"is_unclaimed,omitempty"` } +// MarshalJSON encodes ChatBoostSourceGiveaway with the discriminator field +// "source" forced to "giveaway". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *ChatBoostSourceGiveaway) MarshalJSON() ([]byte, error) { + type alias ChatBoostSourceGiveaway + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "giveaway", + alias: (*alias)(v), + }) +} + // This object contains information about a chat boost. type ChatBoost struct { // Unique identifier of the boost @@ -4030,6 +4734,22 @@ type InputMediaAnimation struct { HasSpoiler *bool `json:"has_spoiler,omitempty"` } +// MarshalJSON encodes InputMediaAnimation with the discriminator field +// "type" forced to "animation". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaAnimation) MarshalJSON() ([]byte, error) { + type alias InputMediaAnimation + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "animation", + alias: (*alias)(v), + }) +} + // Represents an audio file to be treated as music to be sent. type InputMediaAudio struct { // Type of the result, must be audio @@ -4052,6 +4772,22 @@ type InputMediaAudio struct { Title string `json:"title,omitempty"` } +// MarshalJSON encodes InputMediaAudio with the discriminator field +// "type" forced to "audio". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaAudio) MarshalJSON() ([]byte, error) { + type alias InputMediaAudio + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "audio", + alias: (*alias)(v), + }) +} + // Represents a general file to be sent. type InputMediaDocument struct { // Type of the result, must be document @@ -4070,6 +4806,22 @@ type InputMediaDocument struct { DisableContentTypeDetection *bool `json:"disable_content_type_detection,omitempty"` } +// MarshalJSON encodes InputMediaDocument with the discriminator field +// "type" forced to "document". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaDocument) MarshalJSON() ([]byte, error) { + type alias InputMediaDocument + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "document", + alias: (*alias)(v), + }) +} + // Represents a live photo to be sent. type InputMediaLivePhoto struct { // Type of the result, must be live_photo @@ -4090,6 +4842,22 @@ type InputMediaLivePhoto struct { HasSpoiler *bool `json:"has_spoiler,omitempty"` } +// MarshalJSON encodes InputMediaLivePhoto with the discriminator field +// "type" forced to "live_photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaLivePhoto) MarshalJSON() ([]byte, error) { + type alias InputMediaLivePhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "live_photo", + alias: (*alias)(v), + }) +} + // Represents a location to be sent. type InputMediaLocation struct { // Type of the result, must be location @@ -4102,6 +4870,22 @@ type InputMediaLocation struct { HorizontalAccuracy *float64 `json:"horizontal_accuracy,omitempty"` } +// MarshalJSON encodes InputMediaLocation with the discriminator field +// "type" forced to "location". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaLocation) MarshalJSON() ([]byte, error) { + type alias InputMediaLocation + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "location", + alias: (*alias)(v), + }) +} + // Represents a photo to be sent. type InputMediaPhoto struct { // Type of the result, must be photo @@ -4120,6 +4904,22 @@ type InputMediaPhoto struct { HasSpoiler *bool `json:"has_spoiler,omitempty"` } +// MarshalJSON encodes InputMediaPhoto with the discriminator field +// "type" forced to "photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaPhoto) MarshalJSON() ([]byte, error) { + type alias InputMediaPhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "photo", + alias: (*alias)(v), + }) +} + // Represents a sticker file to be sent. type InputMediaSticker struct { // Type of the result, must be sticker @@ -4130,6 +4930,22 @@ type InputMediaSticker struct { Emoji string `json:"emoji,omitempty"` } +// MarshalJSON encodes InputMediaSticker with the discriminator field +// "type" forced to "sticker". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaSticker) MarshalJSON() ([]byte, error) { + type alias InputMediaSticker + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "sticker", + alias: (*alias)(v), + }) +} + // Represents a venue to be sent. type InputMediaVenue struct { // Type of the result, must be venue @@ -4152,6 +4968,22 @@ type InputMediaVenue struct { GooglePlaceType string `json:"google_place_type,omitempty"` } +// MarshalJSON encodes InputMediaVenue with the discriminator field +// "type" forced to "venue". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaVenue) MarshalJSON() ([]byte, error) { + type alias InputMediaVenue + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "venue", + alias: (*alias)(v), + }) +} + // Represents a video to be sent. type InputMediaVideo struct { // Type of the result, must be video @@ -4184,6 +5016,22 @@ type InputMediaVideo struct { HasSpoiler *bool `json:"has_spoiler,omitempty"` } +// MarshalJSON encodes InputMediaVideo with the discriminator field +// "type" forced to "video". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputMediaVideo) MarshalJSON() ([]byte, error) { + type alias InputMediaVideo + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "video", + alias: (*alias)(v), + }) +} + // InputPaidMedia is a union type. The following concrete variants implement // it: // - InputPaidMediaLivePhoto @@ -4212,6 +5060,22 @@ type InputPaidMediaLivePhoto struct { Photo string `json:"photo"` } +// MarshalJSON encodes InputPaidMediaLivePhoto with the discriminator field +// "type" forced to "live_photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputPaidMediaLivePhoto) MarshalJSON() ([]byte, error) { + type alias InputPaidMediaLivePhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "live_photo", + alias: (*alias)(v), + }) +} + // The paid media to send is a photo. type InputPaidMediaPhoto struct { // Type of the media, must be photo @@ -4220,6 +5084,22 @@ type InputPaidMediaPhoto struct { Media string `json:"media"` } +// MarshalJSON encodes InputPaidMediaPhoto with the discriminator field +// "type" forced to "photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputPaidMediaPhoto) MarshalJSON() ([]byte, error) { + type alias InputPaidMediaPhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "photo", + alias: (*alias)(v), + }) +} + // The paid media to send is a video. type InputPaidMediaVideo struct { // Type of the media, must be video @@ -4242,6 +5122,22 @@ type InputPaidMediaVideo struct { SupportsStreaming *bool `json:"supports_streaming,omitempty"` } +// MarshalJSON encodes InputPaidMediaVideo with the discriminator field +// "type" forced to "video". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputPaidMediaVideo) MarshalJSON() ([]byte, error) { + type alias InputPaidMediaVideo + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "video", + alias: (*alias)(v), + }) +} + // InputProfilePhoto is a union type. The following concrete variants implement // it: // - InputProfilePhotoStatic @@ -4264,6 +5160,22 @@ type InputProfilePhotoStatic struct { Photo string `json:"photo"` } +// MarshalJSON encodes InputProfilePhotoStatic with the discriminator field +// "type" forced to "static". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputProfilePhotoStatic) MarshalJSON() ([]byte, error) { + type alias InputProfilePhotoStatic + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "static", + alias: (*alias)(v), + }) +} + // An animated profile photo in the MPEG4 format. type InputProfilePhotoAnimated struct { // Type of the profile photo, must be animated @@ -4274,6 +5186,22 @@ type InputProfilePhotoAnimated struct { MainFrameTimestamp *float64 `json:"main_frame_timestamp,omitempty"` } +// MarshalJSON encodes InputProfilePhotoAnimated with the discriminator field +// "type" forced to "animated". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputProfilePhotoAnimated) MarshalJSON() ([]byte, error) { + type alias InputProfilePhotoAnimated + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "animated", + alias: (*alias)(v), + }) +} + // InputStoryContent is a union type. The following concrete variants implement // it: // - InputStoryContentPhoto @@ -4296,6 +5224,22 @@ type InputStoryContentPhoto struct { Photo string `json:"photo"` } +// MarshalJSON encodes InputStoryContentPhoto with the discriminator field +// "type" forced to "photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputStoryContentPhoto) MarshalJSON() ([]byte, error) { + type alias InputStoryContentPhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "photo", + alias: (*alias)(v), + }) +} + // Describes a video to post as a story. type InputStoryContentVideo struct { // Type of the content, must be video @@ -4310,6 +5254,22 @@ type InputStoryContentVideo struct { IsAnimation *bool `json:"is_animation,omitempty"` } +// MarshalJSON encodes InputStoryContentVideo with the discriminator field +// "type" forced to "video". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InputStoryContentVideo) MarshalJSON() ([]byte, error) { + type alias InputStoryContentVideo + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "video", + alias: (*alias)(v), + }) +} + // This object represents a sticker. type Sticker struct { // Identifier for this file, which can be used to download or reuse the file @@ -4521,6 +5481,22 @@ type InlineQueryResultArticle struct { ThumbnailHeight *int64 `json:"thumbnail_height,omitempty"` } +// MarshalJSON encodes InlineQueryResultArticle with the discriminator field +// "type" forced to "article". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultArticle) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultArticle + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "article", + alias: (*alias)(v), + }) +} + // Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. type InlineQueryResultPhoto struct { // Type of the result, must be photo @@ -4553,6 +5529,22 @@ type InlineQueryResultPhoto struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultPhoto with the discriminator field +// "type" forced to "photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultPhoto) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultPhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "photo", + alias: (*alias)(v), + }) +} + // Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. type InlineQueryResultGif struct { // Type of the result, must be gif @@ -4587,6 +5579,22 @@ type InlineQueryResultGif struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultGif with the discriminator field +// "type" forced to "gif". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultGif) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultGif + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "gif", + alias: (*alias)(v), + }) +} + // Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. type InlineQueryResultMpeg4Gif struct { // Type of the result, must be mpeg4_gif @@ -4621,6 +5629,22 @@ type InlineQueryResultMpeg4Gif struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultMpeg4Gif with the discriminator field +// "type" forced to "mpeg4_gif". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultMpeg4Gif) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultMpeg4Gif + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "mpeg4_gif", + alias: (*alias)(v), + }) +} + // Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. // If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. type InlineQueryResultVideo struct { @@ -4658,6 +5682,22 @@ type InlineQueryResultVideo struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultVideo with the discriminator field +// "type" forced to "video". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultVideo) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultVideo + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "video", + alias: (*alias)(v), + }) +} + // Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. type InlineQueryResultAudio struct { // Type of the result, must be audio @@ -4684,6 +5724,22 @@ type InlineQueryResultAudio struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultAudio with the discriminator field +// "type" forced to "audio". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultAudio) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultAudio + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "audio", + alias: (*alias)(v), + }) +} + // Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message. type InlineQueryResultVoice struct { // Type of the result, must be voice @@ -4708,6 +5764,22 @@ type InlineQueryResultVoice struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultVoice with the discriminator field +// "type" forced to "voice". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultVoice) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultVoice + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "voice", + alias: (*alias)(v), + }) +} + // Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. type InlineQueryResultDocument struct { // Type of the result, must be document @@ -4740,6 +5812,22 @@ type InlineQueryResultDocument struct { ThumbnailHeight *int64 `json:"thumbnail_height,omitempty"` } +// MarshalJSON encodes InlineQueryResultDocument with the discriminator field +// "type" forced to "document". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultDocument) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultDocument + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "document", + alias: (*alias)(v), + }) +} + // Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. type InlineQueryResultLocation struct { // Type of the result, must be location @@ -4772,6 +5860,22 @@ type InlineQueryResultLocation struct { ThumbnailHeight *int64 `json:"thumbnail_height,omitempty"` } +// MarshalJSON encodes InlineQueryResultLocation with the discriminator field +// "type" forced to "location". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultLocation) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultLocation + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "location", + alias: (*alias)(v), + }) +} + // Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. type InlineQueryResultVenue struct { // Type of the result, must be venue @@ -4806,6 +5910,22 @@ type InlineQueryResultVenue struct { ThumbnailHeight *int64 `json:"thumbnail_height,omitempty"` } +// MarshalJSON encodes InlineQueryResultVenue with the discriminator field +// "type" forced to "venue". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultVenue) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultVenue + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "venue", + alias: (*alias)(v), + }) +} + // Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. type InlineQueryResultContact struct { // Type of the result, must be contact @@ -4832,6 +5952,22 @@ type InlineQueryResultContact struct { ThumbnailHeight *int64 `json:"thumbnail_height,omitempty"` } +// MarshalJSON encodes InlineQueryResultContact with the discriminator field +// "type" forced to "contact". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultContact) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultContact + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "contact", + alias: (*alias)(v), + }) +} + // Represents a Game. type InlineQueryResultGame struct { // Type of the result, must be game @@ -4844,6 +5980,22 @@ type InlineQueryResultGame struct { ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } +// MarshalJSON encodes InlineQueryResultGame with the discriminator field +// "type" forced to "game". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultGame) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultGame + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "game", + alias: (*alias)(v), + }) +} + // Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. type InlineQueryResultCachedPhoto struct { // Type of the result, must be photo @@ -4870,6 +6022,22 @@ type InlineQueryResultCachedPhoto struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedPhoto with the discriminator field +// "type" forced to "photo". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedPhoto) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedPhoto + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "photo", + alias: (*alias)(v), + }) +} + // Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. type InlineQueryResultCachedGif struct { // Type of the result, must be gif @@ -4894,6 +6062,22 @@ type InlineQueryResultCachedGif struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedGif with the discriminator field +// "type" forced to "gif". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedGif) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedGif + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "gif", + alias: (*alias)(v), + }) +} + // Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. type InlineQueryResultCachedMpeg4Gif struct { // Type of the result, must be mpeg4_gif @@ -4918,6 +6102,22 @@ type InlineQueryResultCachedMpeg4Gif struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedMpeg4Gif with the discriminator field +// "type" forced to "mpeg4_gif". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedMpeg4Gif) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedMpeg4Gif + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "mpeg4_gif", + alias: (*alias)(v), + }) +} + // Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. type InlineQueryResultCachedSticker struct { // Type of the result, must be sticker @@ -4932,6 +6132,22 @@ type InlineQueryResultCachedSticker struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedSticker with the discriminator field +// "type" forced to "sticker". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedSticker) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedSticker + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "sticker", + alias: (*alias)(v), + }) +} + // Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. type InlineQueryResultCachedDocument struct { // Type of the result, must be document @@ -4956,6 +6172,22 @@ type InlineQueryResultCachedDocument struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedDocument with the discriminator field +// "type" forced to "document". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedDocument) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedDocument + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "document", + alias: (*alias)(v), + }) +} + // Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. type InlineQueryResultCachedVideo struct { // Type of the result, must be video @@ -4982,6 +6214,22 @@ type InlineQueryResultCachedVideo struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedVideo with the discriminator field +// "type" forced to "video". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedVideo) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedVideo + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "video", + alias: (*alias)(v), + }) +} + // Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. type InlineQueryResultCachedVoice struct { // Type of the result, must be voice @@ -5004,6 +6252,22 @@ type InlineQueryResultCachedVoice struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedVoice with the discriminator field +// "type" forced to "voice". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedVoice) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedVoice + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "voice", + alias: (*alias)(v), + }) +} + // Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. type InlineQueryResultCachedAudio struct { // Type of the result, must be audio @@ -5024,6 +6288,22 @@ type InlineQueryResultCachedAudio struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } +// MarshalJSON encodes InlineQueryResultCachedAudio with the discriminator field +// "type" forced to "audio". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *InlineQueryResultCachedAudio) MarshalJSON() ([]byte, error) { + type alias InlineQueryResultCachedAudio + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "audio", + alias: (*alias)(v), + }) +} + // InputMessageContent is a union type. The following concrete variants implement // it: // - InputTextMessageContent @@ -5355,6 +6635,22 @@ type RevenueWithdrawalStatePending struct { Type RevenueWithdrawalStatePendingType `json:"type"` } +// MarshalJSON encodes RevenueWithdrawalStatePending with the discriminator field +// "type" forced to "pending". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *RevenueWithdrawalStatePending) MarshalJSON() ([]byte, error) { + type alias RevenueWithdrawalStatePending + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "pending", + alias: (*alias)(v), + }) +} + // The withdrawal succeeded. type RevenueWithdrawalStateSucceeded struct { // Type of the state, always “succeeded” @@ -5365,12 +6661,44 @@ type RevenueWithdrawalStateSucceeded struct { URL string `json:"url"` } +// MarshalJSON encodes RevenueWithdrawalStateSucceeded with the discriminator field +// "type" forced to "succeeded". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *RevenueWithdrawalStateSucceeded) MarshalJSON() ([]byte, error) { + type alias RevenueWithdrawalStateSucceeded + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "succeeded", + alias: (*alias)(v), + }) +} + // The withdrawal failed and the transaction was refunded. type RevenueWithdrawalStateFailed struct { // Type of the state, always “failed” Type RevenueWithdrawalStateFailedType `json:"type"` } +// MarshalJSON encodes RevenueWithdrawalStateFailed with the discriminator field +// "type" forced to "failed". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *RevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error) { + type alias RevenueWithdrawalStateFailed + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "failed", + alias: (*alias)(v), + }) +} + // Contains information about the affiliate that received a commission via this transaction. type AffiliateInfo struct { // Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user @@ -5473,6 +6801,22 @@ type TransactionPartnerUser struct { PremiumSubscriptionDuration *int64 `json:"premium_subscription_duration,omitempty"` } +// MarshalJSON encodes TransactionPartnerUser with the discriminator field +// "type" forced to "user". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerUser) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerUser + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "user", + alias: (*alias)(v), + }) +} + // UnmarshalJSON decodes TransactionPartnerUser by dispatching union-typed fields // (PaidMedia) through their concrete UnmarshalXxx helpers. func (m *TransactionPartnerUser) UnmarshalJSON(data []byte) error { @@ -5515,6 +6859,22 @@ type TransactionPartnerChat struct { Gift *Gift `json:"gift,omitempty"` } +// MarshalJSON encodes TransactionPartnerChat with the discriminator field +// "type" forced to "chat". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerChat) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerChat + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "chat", + alias: (*alias)(v), + }) +} + // Describes the affiliate program that issued the affiliate commission received via this transaction. type TransactionPartnerAffiliateProgram struct { // Type of the transaction partner, always “affiliate_program” @@ -5525,6 +6885,22 @@ type TransactionPartnerAffiliateProgram struct { CommissionPerMille int64 `json:"commission_per_mille"` } +// MarshalJSON encodes TransactionPartnerAffiliateProgram with the discriminator field +// "type" forced to "affiliate_program". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerAffiliateProgram) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerAffiliateProgram + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "affiliate_program", + alias: (*alias)(v), + }) +} + // Describes a withdrawal transaction with Fragment. type TransactionPartnerFragment struct { // Type of the transaction partner, always “fragment” @@ -5533,6 +6909,22 @@ type TransactionPartnerFragment struct { WithdrawalState RevenueWithdrawalState `json:"withdrawal_state,omitempty"` } +// MarshalJSON encodes TransactionPartnerFragment with the discriminator field +// "type" forced to "fragment". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerFragment) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerFragment + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "fragment", + alias: (*alias)(v), + }) +} + // UnmarshalJSON decodes TransactionPartnerFragment by dispatching union-typed fields // (WithdrawalState) through their concrete UnmarshalXxx helpers. func (m *TransactionPartnerFragment) UnmarshalJSON(data []byte) error { @@ -5563,6 +6955,22 @@ type TransactionPartnerTelegramAds struct { Type TransactionPartnerTelegramAdsType `json:"type"` } +// MarshalJSON encodes TransactionPartnerTelegramAds with the discriminator field +// "type" forced to "telegram_ads". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerTelegramAds) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerTelegramAds + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "telegram_ads", + alias: (*alias)(v), + }) +} + // Describes a transaction with payment for paid broadcasting. type TransactionPartnerTelegramApi struct { // Type of the transaction partner, always “telegram_api” @@ -5571,12 +6979,44 @@ type TransactionPartnerTelegramApi struct { RequestCount int64 `json:"request_count"` } +// MarshalJSON encodes TransactionPartnerTelegramApi with the discriminator field +// "type" forced to "telegram_api". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerTelegramApi + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "telegram_api", + alias: (*alias)(v), + }) +} + // Describes a transaction with an unknown source or recipient. type TransactionPartnerOther struct { // Type of the transaction partner, always “other” Type TransactionPartnerOtherType `json:"type"` } +// MarshalJSON encodes TransactionPartnerOther with the discriminator field +// "type" forced to "other". +// The hardcoded value frees callers from setting Type by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *TransactionPartnerOther) MarshalJSON() ([]byte, error) { + type alias TransactionPartnerOther + return json.Marshal(&struct { + Type string `json:"type"` + *alias + }{ + Type: "other", + alias: (*alias)(v), + }) +} + // Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control. type StarTransaction struct { // Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users. @@ -5743,6 +7183,22 @@ type PassportElementErrorDataField struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorDataField with the discriminator field +// "source" forced to "data". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorDataField) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorDataField + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "data", + alias: (*alias)(v), + }) +} + // Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. type PassportElementErrorFrontSide struct { // Error source, must be front_side @@ -5755,6 +7211,22 @@ type PassportElementErrorFrontSide struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorFrontSide with the discriminator field +// "source" forced to "front_side". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorFrontSide) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorFrontSide + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "front_side", + alias: (*alias)(v), + }) +} + // Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. type PassportElementErrorReverseSide struct { // Error source, must be reverse_side @@ -5767,6 +7239,22 @@ type PassportElementErrorReverseSide struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorReverseSide with the discriminator field +// "source" forced to "reverse_side". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorReverseSide) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorReverseSide + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "reverse_side", + alias: (*alias)(v), + }) +} + // Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. type PassportElementErrorSelfie struct { // Error source, must be selfie @@ -5779,6 +7267,22 @@ type PassportElementErrorSelfie struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorSelfie with the discriminator field +// "source" forced to "selfie". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorSelfie) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorSelfie + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "selfie", + alias: (*alias)(v), + }) +} + // Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. type PassportElementErrorFile struct { // Error source, must be file @@ -5791,6 +7295,22 @@ type PassportElementErrorFile struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorFile with the discriminator field +// "source" forced to "file". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorFile) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorFile + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "file", + alias: (*alias)(v), + }) +} + // Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. type PassportElementErrorFiles struct { // Error source, must be files @@ -5803,6 +7323,22 @@ type PassportElementErrorFiles struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorFiles with the discriminator field +// "source" forced to "files". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorFiles) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorFiles + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "files", + alias: (*alias)(v), + }) +} + // Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. type PassportElementErrorTranslationFile struct { // Error source, must be translation_file @@ -5815,6 +7351,22 @@ type PassportElementErrorTranslationFile struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorTranslationFile with the discriminator field +// "source" forced to "translation_file". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorTranslationFile) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorTranslationFile + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "translation_file", + alias: (*alias)(v), + }) +} + // Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. type PassportElementErrorTranslationFiles struct { // Error source, must be translation_files @@ -5827,6 +7379,22 @@ type PassportElementErrorTranslationFiles struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorTranslationFiles with the discriminator field +// "source" forced to "translation_files". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorTranslationFiles) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorTranslationFiles + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "translation_files", + alias: (*alias)(v), + }) +} + // Represents an issue in an unspecified place. The error is considered resolved when new data is added. type PassportElementErrorUnspecified struct { // Error source, must be unspecified @@ -5839,6 +7407,22 @@ type PassportElementErrorUnspecified struct { Message string `json:"message"` } +// MarshalJSON encodes PassportElementErrorUnspecified with the discriminator field +// "source" forced to "unspecified". +// The hardcoded value frees callers from setting Source by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *PassportElementErrorUnspecified) MarshalJSON() ([]byte, error) { + type alias PassportElementErrorUnspecified + return json.Marshal(&struct { + Source string `json:"source"` + *alias + }{ + Source: "unspecified", + alias: (*alias)(v), + }) +} + // This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. type Game struct { // Title of the game diff --git a/api/unionparam_test.go b/api/unionparam_test.go index 72df034..3ed8017 100644 --- a/api/unionparam_test.go +++ b/api/unionparam_test.go @@ -44,7 +44,7 @@ func TestSetMyCommands_BotCommandScope_NoPointerToInterface(t *testing.T) { // is `BotCommandScope` (interface), not `*BotCommandScope`. ok, err := SetMyCommands(context.Background(), bot, &SetMyCommandsParams{ Commands: []BotCommand{{Command: "start", Description: "begin"}}, - Scope: &BotCommandScopeAllPrivateChats{Type: "all_private_chats"}, + Scope: &BotCommandScopeAllPrivateChats{}, }) require.NoError(t, err) require.True(t, ok) diff --git a/cmd/genapi/emitter.go b/cmd/genapi/emitter.go index d1a15be..34d0fa3 100644 --- a/cmd/genapi/emitter.go +++ b/cmd/genapi/emitter.go @@ -8,12 +8,22 @@ import ( "go/format" "os" "path/filepath" + "regexp" "sort" "text/template" "github.com/lukaszraczylo/go-telegram/internal/spec" ) +// Discriminator-value extractors. The curly form ("always “X”") is +// authoritative because Telegram quotes wire literals with curly quotes +// throughout the docs; the bare form ("must be X") is the looser +// non-quoted variant used for BotCommandScope, InputMedia, etc. +var ( + discCurlyRE = regexp.MustCompile(`(?:must be|always)\s+“([^”]+)”`) + discBareRE = regexp.MustCompile(`must be\s+([A-Za-z0-9_]+)(?:[\s.,]|$)`) +) + //go:embed types.tmpl var typesTmpl string @@ -165,11 +175,154 @@ type emitter struct { api *spec.API outDir string enums *enumPlan + // variantDiscs maps a concrete variant type name (e.g. + // "BotCommandScopeAllPrivateChats") to its discriminator wire-field + // + value. Populated once at construction; consulted by the types + // template to emit per-variant MarshalJSON that hardcodes the + // discriminator so callers don't have to set it by hand. + variantDiscs map[string]variantDiscriminator } func newEmitter(api *spec.API, outDir string) *emitter { knownInterfaceTypes = buildUnionTypeSet(api) - return &emitter{api: api, outDir: outDir, enums: planEnums(api)} + return &emitter{ + api: api, + outDir: outDir, + enums: planEnums(api), + variantDiscs: variantDiscriminators(api), + } +} + +// variantDiscriminator describes the JSON field+value that identifies a +// concrete variant of a sealed-interface union on the wire. +type variantDiscriminator struct { + JSONField string // wire field name, e.g. "type" or "source" + GoField string // Go struct field name, e.g. "Type" or "Source" + Value string // the wire value, e.g. "all_private_chats" +} + +// variantDiscriminators returns variantTypeName → discriminator for every +// concrete struct that participates in a sealed-interface union and has +// a string-typed first field whose doc fixes its value (the canonical +// "must be X" / "always “X”" patterns Telegram uses). +// +// Resolution order: +// +// 1. knownDiscriminators reverse-lookup (the 13 auto-decode unions). +// This guarantees parity with UnmarshalXxx dispatch for the unions +// that round-trip through the library. +// 2. Doc-string analysis of the variant's first field, for marker-only +// unions (BotCommandScope, InputMedia, etc.) where the IR has no +// explicit discriminator metadata. +// +// Variants whose first field has no discriminator hint (Message, +// InaccessibleMessage, the InputMessageContent family) are omitted — +// the caller writes the dispatching fields directly and Telegram +// identifies them structurally. +func variantDiscriminators(api *spec.API) map[string]variantDiscriminator { + out := make(map[string]variantDiscriminator, 128) + + // Pass 1: reverse-lookup from knownDiscriminators. + for _, ds := range knownDiscriminators { + if ds.Field == "" { + continue + } + for value, variant := range ds.Variants { + out[variant] = variantDiscriminator{ + JSONField: ds.Field, + Value: value, + } + } + } + + // Build the set of every variant type referenced by any OneOf so we + // can scan only those (avoids matching free-text "must be" prose in + // non-variant types like Message). + variantSet := make(map[string]bool, 128) + for _, t := range api.Types { + for _, v := range t.OneOf { + variantSet[v] = true + } + } + + // Pass 2: doc-parse for variants without a known discriminator. + for _, t := range api.Types { + if !variantSet[t.Name] { + continue + } + if _, ok := out[t.Name]; ok { + // Pass-1 already provided the wire value; we still need + // the Go field name (mirrors the JSON field but with + // proper case). Resolve from t.Fields by JSONName match. + disc := out[t.Name] + for _, f := range t.Fields { + if f.JSONName == disc.JSONField { + disc.GoField = f.Name + out[t.Name] = disc + break + } + } + continue + } + disc, ok := extractVariantDiscriminator(t) + if !ok { + continue + } + out[t.Name] = disc + } + + // Drop entries we couldn't resolve a Go field for (defensive — every + // pass-1 hit should have matched, but better to skip than emit + // broken code referencing an unknown field name). + for name, d := range out { + if d.GoField == "" { + delete(out, name) + } + } + return out +} + +// extractVariantDiscriminator inspects the first field of a variant +// struct and returns its discriminator if the field is a required +// string whose doc nails the value via "must be X" or "always “X”". +// Returns (zero, false) when no clear discriminator is present. +func extractVariantDiscriminator(t spec.TypeDecl) (variantDiscriminator, bool) { + if len(t.Fields) == 0 { + return variantDiscriminator{}, false + } + f := t.Fields[0] + if !f.Required || f.Type.Kind != spec.KindPrimitive || f.Type.Name != "string" { + return variantDiscriminator{}, false + } + value := parseDiscriminatorDoc(f.Doc) + if value == "" { + return variantDiscriminator{}, false + } + return variantDiscriminator{ + JSONField: f.JSONName, + GoField: f.Name, + Value: value, + }, true +} + +// parseDiscriminatorDoc extracts the wire-level discriminator value +// from a field doc string. Handles both Telegram phrasings: +// +// - "Scope type, must be all_private_chats" (bare token) +// - "Type of the message origin, always “user”" (curly-quoted) +// +// Returns "" when no discriminator is present. +func parseDiscriminatorDoc(doc string) string { + // Curly-quoted form takes priority: "must be “X”" or "always “X”". + if m := discCurlyRE.FindStringSubmatch(doc); len(m) == 2 { + return m[1] + } + // Bare-token form: "must be " terminated by end-of-string, + // punctuation, or whitespace. + if m := discBareRE.FindStringSubmatch(doc); len(m) == 2 { + return m[1] + } + return "" } // knownInterfaceTypes is the full set of sealed-interface union type names @@ -182,7 +335,7 @@ var knownInterfaceTypes = map[string]bool{} // emitTypes renders types.gen.go. func (e *emitter) emitTypes() error { - t, err := template.New("types").Funcs(funcs(e.enums)).Parse(typesTmpl) + t, err := template.New("types").Funcs(funcsWithDiscs(e.enums, e.variantDiscs)).Parse(typesTmpl) if err != nil { return fmt.Errorf("parse types.tmpl: %w", err) } @@ -218,6 +371,22 @@ func loadAPI(path string) (*spec.API, error) { return &api, nil } +// funcsWithDiscs returns the shared FuncMap with the variant +// discriminator helpers bound to discs. types.tmpl uses +// variantDiscFor/variantHasDisc to emit per-variant MarshalJSON that +// hardcodes the wire discriminator value. +func funcsWithDiscs(plan *enumPlan, discs map[string]variantDiscriminator) template.FuncMap { + fm := funcs(plan) + fm["variantHasDisc"] = func(name string) bool { + _, ok := discs[name] + return ok + } + fm["variantDiscField"] = func(name string) string { return discs[name].JSONField } + fm["variantDiscGoField"] = func(name string) string { return discs[name].GoField } + fm["variantDiscValue"] = func(name string) string { return discs[name].Value } + return fm +} + // funcs is the FuncMap shared across templates. plan is the resolved // enum plan; pass nil only in unit tests that don't exercise enums. func funcs(plan *enumPlan) template.FuncMap { diff --git a/cmd/genapi/types.tmpl b/cmd/genapi/types.tmpl index cc011ab..c065223 100644 --- a/cmd/genapi/types.tmpl +++ b/cmd/genapi/types.tmpl @@ -84,6 +84,23 @@ func UnmarshalMaybeInaccessibleMessage(data []byte) (MaybeInaccessibleMessage, e type {{.Name}} struct { {{range .Fields}}{{docComment .Doc}}{{goField $td.Name .}} {{end}}} +{{if variantHasDisc .Name}} +// MarshalJSON encodes {{.Name}} with the discriminator field +// "{{variantDiscField .Name}}" forced to {{printf "%q" (variantDiscValue .Name)}}. +// The hardcoded value frees callers from setting {{variantDiscGoField .Name}} by hand — +// any user-supplied value on the struct literal is overridden so a typo +// can't slip through to Telegram. +func (v *{{.Name}}) MarshalJSON() ([]byte, error) { + type alias {{.Name}} + return json.Marshal(&struct { + {{variantDiscGoField .Name}} string `json:"{{variantDiscField .Name}}"` + *alias + }{ + {{variantDiscGoField .Name}}: {{printf "%q" (variantDiscValue .Name)}}, + alias: (*alias)(v), + }) +} +{{end}} {{$unionFields := unionFields .}}{{if $unionFields}} // UnmarshalJSON decodes {{.Name}} by dispatching union-typed fields // ({{range $i, $u := $unionFields}}{{if $i}}, {{end}}{{$u.Field.Name}}{{end}}) through their concrete UnmarshalXxx helpers. diff --git a/dispatch/filters/message/message_test.go b/dispatch/filters/message/message_test.go index 3b70fab..89b1de5 100644 --- a/dispatch/filters/message/message_test.go +++ b/dispatch/filters/message/message_test.go @@ -109,7 +109,7 @@ func TestIsForward(t *testing.T) { // ForwardOrigin is a MessageOrigin interface; set via a concrete type. f := msgfilter.IsForward() m := msg("fwd") - m.ForwardOrigin = &api.MessageOriginUser{Type: "user"} + m.ForwardOrigin = &api.MessageOriginUser{} require.True(t, f(m)) require.False(t, f(msg("no fwd"))) require.False(t, f(nil)) diff --git a/docs/reference/api.md b/docs/reference/api.md index 95e9a98..4fcf67a 100644 --- a/docs/reference/api.md +++ b/docs/reference/api.md @@ -133,22 +133,29 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type BackgroundFill](<#BackgroundFill>) - [func UnmarshalBackgroundFill\(data \[\]byte\) \(BackgroundFill, error\)](<#UnmarshalBackgroundFill>) - [type BackgroundFillFreeformGradient](<#BackgroundFillFreeformGradient>) + - [func \(v \*BackgroundFillFreeformGradient\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundFillFreeformGradient.MarshalJSON>) - [type BackgroundFillFreeformGradientType](<#BackgroundFillFreeformGradientType>) - [type BackgroundFillGradient](<#BackgroundFillGradient>) + - [func \(v \*BackgroundFillGradient\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundFillGradient.MarshalJSON>) - [type BackgroundFillGradientType](<#BackgroundFillGradientType>) - [type BackgroundFillSolid](<#BackgroundFillSolid>) + - [func \(v \*BackgroundFillSolid\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundFillSolid.MarshalJSON>) - [type BackgroundFillSolidType](<#BackgroundFillSolidType>) - [type BackgroundType](<#BackgroundType>) - [func UnmarshalBackgroundType\(data \[\]byte\) \(BackgroundType, error\)](<#UnmarshalBackgroundType>) - [type BackgroundTypeChatTheme](<#BackgroundTypeChatTheme>) + - [func \(v \*BackgroundTypeChatTheme\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundTypeChatTheme.MarshalJSON>) - [type BackgroundTypeChatThemeType](<#BackgroundTypeChatThemeType>) - [type BackgroundTypeFill](<#BackgroundTypeFill>) + - [func \(v \*BackgroundTypeFill\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundTypeFill.MarshalJSON>) - [func \(m \*BackgroundTypeFill\) UnmarshalJSON\(data \[\]byte\) error](<#BackgroundTypeFill.UnmarshalJSON>) - [type BackgroundTypeFillType](<#BackgroundTypeFillType>) - [type BackgroundTypePattern](<#BackgroundTypePattern>) + - [func \(v \*BackgroundTypePattern\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundTypePattern.MarshalJSON>) - [func \(m \*BackgroundTypePattern\) UnmarshalJSON\(data \[\]byte\) error](<#BackgroundTypePattern.UnmarshalJSON>) - [type BackgroundTypePatternType](<#BackgroundTypePatternType>) - [type BackgroundTypeWallpaper](<#BackgroundTypeWallpaper>) + - [func \(v \*BackgroundTypeWallpaper\) MarshalJSON\(\) \(\[\]byte, error\)](<#BackgroundTypeWallpaper.MarshalJSON>) - [type BackgroundTypeWallpaperType](<#BackgroundTypeWallpaperType>) - [type BanChatMemberParams](<#BanChatMemberParams>) - [type BanChatSenderChatParams](<#BanChatSenderChatParams>) @@ -159,12 +166,19 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [func GetMyCommands\(ctx context.Context, b \*client.Bot, p \*GetMyCommandsParams\) \(\[\]BotCommand, error\)](<#GetMyCommands>) - [type BotCommandScope](<#BotCommandScope>) - [type BotCommandScopeAllChatAdministrators](<#BotCommandScopeAllChatAdministrators>) + - [func \(v \*BotCommandScopeAllChatAdministrators\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeAllChatAdministrators.MarshalJSON>) - [type BotCommandScopeAllGroupChats](<#BotCommandScopeAllGroupChats>) + - [func \(v \*BotCommandScopeAllGroupChats\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeAllGroupChats.MarshalJSON>) - [type BotCommandScopeAllPrivateChats](<#BotCommandScopeAllPrivateChats>) + - [func \(v \*BotCommandScopeAllPrivateChats\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeAllPrivateChats.MarshalJSON>) - [type BotCommandScopeChat](<#BotCommandScopeChat>) + - [func \(v \*BotCommandScopeChat\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeChat.MarshalJSON>) - [type BotCommandScopeChatAdministrators](<#BotCommandScopeChatAdministrators>) + - [func \(v \*BotCommandScopeChatAdministrators\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeChatAdministrators.MarshalJSON>) - [type BotCommandScopeChatMember](<#BotCommandScopeChatMember>) + - [func \(v \*BotCommandScopeChatMember\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeChatMember.MarshalJSON>) - [type BotCommandScopeDefault](<#BotCommandScopeDefault>) + - [func \(v \*BotCommandScopeDefault\) MarshalJSON\(\) \(\[\]byte, error\)](<#BotCommandScopeDefault.MarshalJSON>) - [type BotDescription](<#BotDescription>) - [func GetMyDescription\(ctx context.Context, b \*client.Bot, p \*GetMyDescriptionParams\) \(\*BotDescription, error\)](<#GetMyDescription>) - [type BotName](<#BotName>) @@ -195,10 +209,13 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type ChatBoostSource](<#ChatBoostSource>) - [func UnmarshalChatBoostSource\(data \[\]byte\) \(ChatBoostSource, error\)](<#UnmarshalChatBoostSource>) - [type ChatBoostSourceGiftCode](<#ChatBoostSourceGiftCode>) + - [func \(v \*ChatBoostSourceGiftCode\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatBoostSourceGiftCode.MarshalJSON>) - [type ChatBoostSourceGiftCodeSource](<#ChatBoostSourceGiftCodeSource>) - [type ChatBoostSourceGiveaway](<#ChatBoostSourceGiveaway>) + - [func \(v \*ChatBoostSourceGiveaway\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatBoostSourceGiveaway.MarshalJSON>) - [type ChatBoostSourceGiveawaySource](<#ChatBoostSourceGiveawaySource>) - [type ChatBoostSourcePremium](<#ChatBoostSourcePremium>) + - [func \(v \*ChatBoostSourcePremium\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatBoostSourcePremium.MarshalJSON>) - [type ChatBoostSourcePremiumSource](<#ChatBoostSourcePremiumSource>) - [type ChatBoostUpdated](<#ChatBoostUpdated>) - [type ChatFullInfo](<#ChatFullInfo>) @@ -224,16 +241,22 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [func GetChatMember\(ctx context.Context, b \*client.Bot, p \*GetChatMemberParams\) \(ChatMember, error\)](<#GetChatMember>) - [func UnmarshalChatMember\(data \[\]byte\) \(ChatMember, error\)](<#UnmarshalChatMember>) - [type ChatMemberAdministrator](<#ChatMemberAdministrator>) + - [func \(v \*ChatMemberAdministrator\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatMemberAdministrator.MarshalJSON>) - [type ChatMemberAdministratorStatus](<#ChatMemberAdministratorStatus>) - [type ChatMemberBanned](<#ChatMemberBanned>) + - [func \(v \*ChatMemberBanned\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatMemberBanned.MarshalJSON>) - [type ChatMemberBannedStatus](<#ChatMemberBannedStatus>) - [type ChatMemberLeft](<#ChatMemberLeft>) + - [func \(v \*ChatMemberLeft\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatMemberLeft.MarshalJSON>) - [type ChatMemberLeftStatus](<#ChatMemberLeftStatus>) - [type ChatMemberMember](<#ChatMemberMember>) + - [func \(v \*ChatMemberMember\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatMemberMember.MarshalJSON>) - [type ChatMemberMemberStatus](<#ChatMemberMemberStatus>) - [type ChatMemberOwner](<#ChatMemberOwner>) + - [func \(v \*ChatMemberOwner\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatMemberOwner.MarshalJSON>) - [type ChatMemberOwnerStatus](<#ChatMemberOwnerStatus>) - [type ChatMemberRestricted](<#ChatMemberRestricted>) + - [func \(v \*ChatMemberRestricted\) MarshalJSON\(\) \(\[\]byte, error\)](<#ChatMemberRestricted.MarshalJSON>) - [type ChatMemberRestrictedStatus](<#ChatMemberRestrictedStatus>) - [type ChatMemberUpdated](<#ChatMemberUpdated>) - [func \(m \*ChatMemberUpdated\) UnmarshalJSON\(data \[\]byte\) error](<#ChatMemberUpdated.UnmarshalJSON>) @@ -369,27 +392,47 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type InlineQueryChatType](<#InlineQueryChatType>) - [type InlineQueryResult](<#InlineQueryResult>) - [type InlineQueryResultArticle](<#InlineQueryResultArticle>) + - [func \(v \*InlineQueryResultArticle\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultArticle.MarshalJSON>) - [type InlineQueryResultAudio](<#InlineQueryResultAudio>) + - [func \(v \*InlineQueryResultAudio\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultAudio.MarshalJSON>) - [type InlineQueryResultCachedAudio](<#InlineQueryResultCachedAudio>) + - [func \(v \*InlineQueryResultCachedAudio\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedAudio.MarshalJSON>) - [type InlineQueryResultCachedDocument](<#InlineQueryResultCachedDocument>) + - [func \(v \*InlineQueryResultCachedDocument\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedDocument.MarshalJSON>) - [type InlineQueryResultCachedGif](<#InlineQueryResultCachedGif>) + - [func \(v \*InlineQueryResultCachedGif\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedGif.MarshalJSON>) - [type InlineQueryResultCachedMpeg4Gif](<#InlineQueryResultCachedMpeg4Gif>) + - [func \(v \*InlineQueryResultCachedMpeg4Gif\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedMpeg4Gif.MarshalJSON>) - [type InlineQueryResultCachedPhoto](<#InlineQueryResultCachedPhoto>) + - [func \(v \*InlineQueryResultCachedPhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedPhoto.MarshalJSON>) - [type InlineQueryResultCachedSticker](<#InlineQueryResultCachedSticker>) + - [func \(v \*InlineQueryResultCachedSticker\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedSticker.MarshalJSON>) - [type InlineQueryResultCachedVideo](<#InlineQueryResultCachedVideo>) + - [func \(v \*InlineQueryResultCachedVideo\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedVideo.MarshalJSON>) - [type InlineQueryResultCachedVoice](<#InlineQueryResultCachedVoice>) + - [func \(v \*InlineQueryResultCachedVoice\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultCachedVoice.MarshalJSON>) - [type InlineQueryResultContact](<#InlineQueryResultContact>) + - [func \(v \*InlineQueryResultContact\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultContact.MarshalJSON>) - [type InlineQueryResultDocument](<#InlineQueryResultDocument>) + - [func \(v \*InlineQueryResultDocument\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultDocument.MarshalJSON>) - [type InlineQueryResultDocumentMimeType](<#InlineQueryResultDocumentMimeType>) - [type InlineQueryResultGame](<#InlineQueryResultGame>) + - [func \(v \*InlineQueryResultGame\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultGame.MarshalJSON>) - [type InlineQueryResultGif](<#InlineQueryResultGif>) + - [func \(v \*InlineQueryResultGif\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultGif.MarshalJSON>) - [type InlineQueryResultGifThumbnailMimeType](<#InlineQueryResultGifThumbnailMimeType>) - [type InlineQueryResultLocation](<#InlineQueryResultLocation>) + - [func \(v \*InlineQueryResultLocation\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultLocation.MarshalJSON>) - [type InlineQueryResultMpeg4Gif](<#InlineQueryResultMpeg4Gif>) + - [func \(v \*InlineQueryResultMpeg4Gif\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultMpeg4Gif.MarshalJSON>) - [type InlineQueryResultPhoto](<#InlineQueryResultPhoto>) + - [func \(v \*InlineQueryResultPhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultPhoto.MarshalJSON>) - [type InlineQueryResultVenue](<#InlineQueryResultVenue>) + - [func \(v \*InlineQueryResultVenue\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultVenue.MarshalJSON>) - [type InlineQueryResultVideo](<#InlineQueryResultVideo>) + - [func \(v \*InlineQueryResultVideo\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultVideo.MarshalJSON>) - [type InlineQueryResultVoice](<#InlineQueryResultVoice>) + - [func \(v \*InlineQueryResultVoice\) MarshalJSON\(\) \(\[\]byte, error\)](<#InlineQueryResultVoice.MarshalJSON>) - [type InlineQueryResultsButton](<#InlineQueryResultsButton>) - [type InputChecklist](<#InputChecklist>) - [type InputChecklistTask](<#InputChecklistTask>) @@ -400,30 +443,46 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type InputLocationMessageContent](<#InputLocationMessageContent>) - [type InputMedia](<#InputMedia>) - [type InputMediaAnimation](<#InputMediaAnimation>) + - [func \(v \*InputMediaAnimation\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaAnimation.MarshalJSON>) - [type InputMediaAudio](<#InputMediaAudio>) + - [func \(v \*InputMediaAudio\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaAudio.MarshalJSON>) - [type InputMediaDocument](<#InputMediaDocument>) + - [func \(v \*InputMediaDocument\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaDocument.MarshalJSON>) - [type InputMediaLivePhoto](<#InputMediaLivePhoto>) + - [func \(v \*InputMediaLivePhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaLivePhoto.MarshalJSON>) - [type InputMediaLocation](<#InputMediaLocation>) + - [func \(v \*InputMediaLocation\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaLocation.MarshalJSON>) - [type InputMediaPhoto](<#InputMediaPhoto>) + - [func \(v \*InputMediaPhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaPhoto.MarshalJSON>) - [type InputMediaSticker](<#InputMediaSticker>) + - [func \(v \*InputMediaSticker\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaSticker.MarshalJSON>) - [type InputMediaVenue](<#InputMediaVenue>) + - [func \(v \*InputMediaVenue\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaVenue.MarshalJSON>) - [type InputMediaVideo](<#InputMediaVideo>) + - [func \(v \*InputMediaVideo\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputMediaVideo.MarshalJSON>) - [type InputMessageContent](<#InputMessageContent>) - [type InputPaidMedia](<#InputPaidMedia>) - [type InputPaidMediaLivePhoto](<#InputPaidMediaLivePhoto>) + - [func \(v \*InputPaidMediaLivePhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputPaidMediaLivePhoto.MarshalJSON>) - [type InputPaidMediaPhoto](<#InputPaidMediaPhoto>) + - [func \(v \*InputPaidMediaPhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputPaidMediaPhoto.MarshalJSON>) - [type InputPaidMediaVideo](<#InputPaidMediaVideo>) + - [func \(v \*InputPaidMediaVideo\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputPaidMediaVideo.MarshalJSON>) - [type InputPollMedia](<#InputPollMedia>) - [type InputPollOption](<#InputPollOption>) - [type InputPollOptionMedia](<#InputPollOptionMedia>) - [type InputProfilePhoto](<#InputProfilePhoto>) - [type InputProfilePhotoAnimated](<#InputProfilePhotoAnimated>) + - [func \(v \*InputProfilePhotoAnimated\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputProfilePhotoAnimated.MarshalJSON>) - [type InputProfilePhotoStatic](<#InputProfilePhotoStatic>) + - [func \(v \*InputProfilePhotoStatic\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputProfilePhotoStatic.MarshalJSON>) - [type InputSticker](<#InputSticker>) - [type InputStickerFormat](<#InputStickerFormat>) - [type InputStoryContent](<#InputStoryContent>) - [type InputStoryContentPhoto](<#InputStoryContentPhoto>) + - [func \(v \*InputStoryContentPhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputStoryContentPhoto.MarshalJSON>) - [type InputStoryContentVideo](<#InputStoryContentVideo>) + - [func \(v \*InputStoryContentVideo\) MarshalJSON\(\) \(\[\]byte, error\)](<#InputStoryContentVideo.MarshalJSON>) - [type InputTextMessageContent](<#InputTextMessageContent>) - [type InputVenueMessageContent](<#InputVenueMessageContent>) - [type Invoice](<#Invoice>) @@ -454,8 +513,11 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [func GetChatMenuButton\(ctx context.Context, b \*client.Bot, p \*GetChatMenuButtonParams\) \(MenuButton, error\)](<#GetChatMenuButton>) - [func UnmarshalMenuButton\(data \[\]byte\) \(MenuButton, error\)](<#UnmarshalMenuButton>) - [type MenuButtonCommands](<#MenuButtonCommands>) + - [func \(v \*MenuButtonCommands\) MarshalJSON\(\) \(\[\]byte, error\)](<#MenuButtonCommands.MarshalJSON>) - [type MenuButtonDefault](<#MenuButtonDefault>) + - [func \(v \*MenuButtonDefault\) MarshalJSON\(\) \(\[\]byte, error\)](<#MenuButtonDefault.MarshalJSON>) - [type MenuButtonWebApp](<#MenuButtonWebApp>) + - [func \(v \*MenuButtonWebApp\) MarshalJSON\(\) \(\[\]byte, error\)](<#MenuButtonWebApp.MarshalJSON>) - [type Message](<#Message>) - [func EditMessageChecklist\(ctx context.Context, b \*client.Bot, p \*EditMessageChecklistParams\) \(\*Message, error\)](<#EditMessageChecklist>) - [func ForwardMessage\(ctx context.Context, b \*client.Bot, p \*ForwardMessageParams\) \(\*Message, error\)](<#ForwardMessage>) @@ -501,12 +563,16 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type MessageOrigin](<#MessageOrigin>) - [func UnmarshalMessageOrigin\(data \[\]byte\) \(MessageOrigin, error\)](<#UnmarshalMessageOrigin>) - [type MessageOriginChannel](<#MessageOriginChannel>) + - [func \(v \*MessageOriginChannel\) MarshalJSON\(\) \(\[\]byte, error\)](<#MessageOriginChannel.MarshalJSON>) - [type MessageOriginChannelType](<#MessageOriginChannelType>) - [type MessageOriginChat](<#MessageOriginChat>) + - [func \(v \*MessageOriginChat\) MarshalJSON\(\) \(\[\]byte, error\)](<#MessageOriginChat.MarshalJSON>) - [type MessageOriginChatType](<#MessageOriginChatType>) - [type MessageOriginHiddenUser](<#MessageOriginHiddenUser>) + - [func \(v \*MessageOriginHiddenUser\) MarshalJSON\(\) \(\[\]byte, error\)](<#MessageOriginHiddenUser.MarshalJSON>) - [type MessageOriginHiddenUserType](<#MessageOriginHiddenUserType>) - [type MessageOriginUser](<#MessageOriginUser>) + - [func \(v \*MessageOriginUser\) MarshalJSON\(\) \(\[\]byte, error\)](<#MessageOriginUser.MarshalJSON>) - [type MessageOriginUserType](<#MessageOriginUserType>) - [type MessageReactionCountUpdated](<#MessageReactionCountUpdated>) - [type MessageReactionUpdated](<#MessageReactionUpdated>) @@ -516,8 +582,10 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type OwnedGift](<#OwnedGift>) - [func UnmarshalOwnedGift\(data \[\]byte\) \(OwnedGift, error\)](<#UnmarshalOwnedGift>) - [type OwnedGiftRegular](<#OwnedGiftRegular>) + - [func \(v \*OwnedGiftRegular\) MarshalJSON\(\) \(\[\]byte, error\)](<#OwnedGiftRegular.MarshalJSON>) - [type OwnedGiftRegularType](<#OwnedGiftRegularType>) - [type OwnedGiftUnique](<#OwnedGiftUnique>) + - [func \(v \*OwnedGiftUnique\) MarshalJSON\(\) \(\[\]byte, error\)](<#OwnedGiftUnique.MarshalJSON>) - [type OwnedGiftUniqueType](<#OwnedGiftUniqueType>) - [type OwnedGifts](<#OwnedGifts>) - [func GetBusinessAccountGifts\(ctx context.Context, b \*client.Bot, p \*GetBusinessAccountGiftsParams\) \(\*OwnedGifts, error\)](<#GetBusinessAccountGifts>) @@ -529,32 +597,45 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type PaidMediaInfo](<#PaidMediaInfo>) - [func \(m \*PaidMediaInfo\) UnmarshalJSON\(data \[\]byte\) error](<#PaidMediaInfo.UnmarshalJSON>) - [type PaidMediaLivePhoto](<#PaidMediaLivePhoto>) + - [func \(v \*PaidMediaLivePhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#PaidMediaLivePhoto.MarshalJSON>) - [type PaidMediaLivePhotoType](<#PaidMediaLivePhotoType>) - [type PaidMediaPhoto](<#PaidMediaPhoto>) + - [func \(v \*PaidMediaPhoto\) MarshalJSON\(\) \(\[\]byte, error\)](<#PaidMediaPhoto.MarshalJSON>) - [type PaidMediaPhotoType](<#PaidMediaPhotoType>) - [type PaidMediaPreview](<#PaidMediaPreview>) + - [func \(v \*PaidMediaPreview\) MarshalJSON\(\) \(\[\]byte, error\)](<#PaidMediaPreview.MarshalJSON>) - [type PaidMediaPreviewType](<#PaidMediaPreviewType>) - [type PaidMediaPurchased](<#PaidMediaPurchased>) - [type PaidMediaVideo](<#PaidMediaVideo>) + - [func \(v \*PaidMediaVideo\) MarshalJSON\(\) \(\[\]byte, error\)](<#PaidMediaVideo.MarshalJSON>) - [type PaidMediaVideoType](<#PaidMediaVideoType>) - [type PaidMessagePriceChanged](<#PaidMessagePriceChanged>) - [type ParseMode](<#ParseMode>) - [type PassportData](<#PassportData>) - [type PassportElementError](<#PassportElementError>) - [type PassportElementErrorDataField](<#PassportElementErrorDataField>) + - [func \(v \*PassportElementErrorDataField\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorDataField.MarshalJSON>) - [type PassportElementErrorDataFieldType](<#PassportElementErrorDataFieldType>) - [type PassportElementErrorFile](<#PassportElementErrorFile>) + - [func \(v \*PassportElementErrorFile\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorFile.MarshalJSON>) - [type PassportElementErrorFileType](<#PassportElementErrorFileType>) - [type PassportElementErrorFiles](<#PassportElementErrorFiles>) + - [func \(v \*PassportElementErrorFiles\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorFiles.MarshalJSON>) - [type PassportElementErrorFrontSide](<#PassportElementErrorFrontSide>) + - [func \(v \*PassportElementErrorFrontSide\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorFrontSide.MarshalJSON>) - [type PassportElementErrorReverseSide](<#PassportElementErrorReverseSide>) + - [func \(v \*PassportElementErrorReverseSide\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorReverseSide.MarshalJSON>) - [type PassportElementErrorReverseSideType](<#PassportElementErrorReverseSideType>) - [type PassportElementErrorSelfie](<#PassportElementErrorSelfie>) + - [func \(v \*PassportElementErrorSelfie\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorSelfie.MarshalJSON>) - [type PassportElementErrorSelfieType](<#PassportElementErrorSelfieType>) - [type PassportElementErrorTranslationFile](<#PassportElementErrorTranslationFile>) + - [func \(v \*PassportElementErrorTranslationFile\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorTranslationFile.MarshalJSON>) - [type PassportElementErrorTranslationFileType](<#PassportElementErrorTranslationFileType>) - [type PassportElementErrorTranslationFiles](<#PassportElementErrorTranslationFiles>) + - [func \(v \*PassportElementErrorTranslationFiles\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorTranslationFiles.MarshalJSON>) - [type PassportElementErrorUnspecified](<#PassportElementErrorUnspecified>) + - [func \(v \*PassportElementErrorUnspecified\) MarshalJSON\(\) \(\[\]byte, error\)](<#PassportElementErrorUnspecified.MarshalJSON>) - [type PassportFile](<#PassportFile>) - [type PhotoSize](<#PhotoSize>) - [type PinChatMessageParams](<#PinChatMessageParams>) @@ -582,10 +663,13 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type ReactionType](<#ReactionType>) - [func UnmarshalReactionType\(data \[\]byte\) \(ReactionType, error\)](<#UnmarshalReactionType>) - [type ReactionTypeCustomEmoji](<#ReactionTypeCustomEmoji>) + - [func \(v \*ReactionTypeCustomEmoji\) MarshalJSON\(\) \(\[\]byte, error\)](<#ReactionTypeCustomEmoji.MarshalJSON>) - [type ReactionTypeCustomEmojiType](<#ReactionTypeCustomEmojiType>) - [type ReactionTypeEmoji](<#ReactionTypeEmoji>) + - [func \(v \*ReactionTypeEmoji\) MarshalJSON\(\) \(\[\]byte, error\)](<#ReactionTypeEmoji.MarshalJSON>) - [type ReactionTypeEmojiType](<#ReactionTypeEmojiType>) - [type ReactionTypePaid](<#ReactionTypePaid>) + - [func \(v \*ReactionTypePaid\) MarshalJSON\(\) \(\[\]byte, error\)](<#ReactionTypePaid.MarshalJSON>) - [type ReactionTypePaidType](<#ReactionTypePaidType>) - [type ReadBusinessMessageParams](<#ReadBusinessMessageParams>) - [type RefundStarPaymentParams](<#RefundStarPaymentParams>) @@ -608,10 +692,13 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type RevenueWithdrawalState](<#RevenueWithdrawalState>) - [func UnmarshalRevenueWithdrawalState\(data \[\]byte\) \(RevenueWithdrawalState, error\)](<#UnmarshalRevenueWithdrawalState>) - [type RevenueWithdrawalStateFailed](<#RevenueWithdrawalStateFailed>) + - [func \(v \*RevenueWithdrawalStateFailed\) MarshalJSON\(\) \(\[\]byte, error\)](<#RevenueWithdrawalStateFailed.MarshalJSON>) - [type RevenueWithdrawalStateFailedType](<#RevenueWithdrawalStateFailedType>) - [type RevenueWithdrawalStatePending](<#RevenueWithdrawalStatePending>) + - [func \(v \*RevenueWithdrawalStatePending\) MarshalJSON\(\) \(\[\]byte, error\)](<#RevenueWithdrawalStatePending.MarshalJSON>) - [type RevenueWithdrawalStatePendingType](<#RevenueWithdrawalStatePendingType>) - [type RevenueWithdrawalStateSucceeded](<#RevenueWithdrawalStateSucceeded>) + - [func \(v \*RevenueWithdrawalStateSucceeded\) MarshalJSON\(\) \(\[\]byte, error\)](<#RevenueWithdrawalStateSucceeded.MarshalJSON>) - [type RevenueWithdrawalStateSucceededType](<#RevenueWithdrawalStateSucceededType>) - [type RevokeChatInviteLinkParams](<#RevokeChatInviteLinkParams>) - [type SavePreparedInlineMessageParams](<#SavePreparedInlineMessageParams>) @@ -750,15 +837,20 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type StoryAreaType](<#StoryAreaType>) - [func UnmarshalStoryAreaType\(data \[\]byte\) \(StoryAreaType, error\)](<#UnmarshalStoryAreaType>) - [type StoryAreaTypeLink](<#StoryAreaTypeLink>) + - [func \(v \*StoryAreaTypeLink\) MarshalJSON\(\) \(\[\]byte, error\)](<#StoryAreaTypeLink.MarshalJSON>) - [type StoryAreaTypeLinkType](<#StoryAreaTypeLinkType>) - [type StoryAreaTypeLocation](<#StoryAreaTypeLocation>) + - [func \(v \*StoryAreaTypeLocation\) MarshalJSON\(\) \(\[\]byte, error\)](<#StoryAreaTypeLocation.MarshalJSON>) - [type StoryAreaTypeLocationType](<#StoryAreaTypeLocationType>) - [type StoryAreaTypeSuggestedReaction](<#StoryAreaTypeSuggestedReaction>) + - [func \(v \*StoryAreaTypeSuggestedReaction\) MarshalJSON\(\) \(\[\]byte, error\)](<#StoryAreaTypeSuggestedReaction.MarshalJSON>) - [func \(m \*StoryAreaTypeSuggestedReaction\) UnmarshalJSON\(data \[\]byte\) error](<#StoryAreaTypeSuggestedReaction.UnmarshalJSON>) - [type StoryAreaTypeSuggestedReactionType](<#StoryAreaTypeSuggestedReactionType>) - [type StoryAreaTypeUniqueGift](<#StoryAreaTypeUniqueGift>) + - [func \(v \*StoryAreaTypeUniqueGift\) MarshalJSON\(\) \(\[\]byte, error\)](<#StoryAreaTypeUniqueGift.MarshalJSON>) - [type StoryAreaTypeUniqueGiftType](<#StoryAreaTypeUniqueGiftType>) - [type StoryAreaTypeWeather](<#StoryAreaTypeWeather>) + - [func \(v \*StoryAreaTypeWeather\) MarshalJSON\(\) \(\[\]byte, error\)](<#StoryAreaTypeWeather.MarshalJSON>) - [type StoryAreaTypeWeatherType](<#StoryAreaTypeWeatherType>) - [type SuccessfulPayment](<#SuccessfulPayment>) - [type SuggestedPostApprovalFailed](<#SuggestedPostApprovalFailed>) @@ -777,18 +869,25 @@ Package api contains the Telegram Bot API object types and method wrappers, gene - [type TransactionPartner](<#TransactionPartner>) - [func UnmarshalTransactionPartner\(data \[\]byte\) \(TransactionPartner, error\)](<#UnmarshalTransactionPartner>) - [type TransactionPartnerAffiliateProgram](<#TransactionPartnerAffiliateProgram>) + - [func \(v \*TransactionPartnerAffiliateProgram\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerAffiliateProgram.MarshalJSON>) - [type TransactionPartnerAffiliateProgramType](<#TransactionPartnerAffiliateProgramType>) - [type TransactionPartnerChat](<#TransactionPartnerChat>) + - [func \(v \*TransactionPartnerChat\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerChat.MarshalJSON>) - [type TransactionPartnerFragment](<#TransactionPartnerFragment>) + - [func \(v \*TransactionPartnerFragment\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerFragment.MarshalJSON>) - [func \(m \*TransactionPartnerFragment\) UnmarshalJSON\(data \[\]byte\) error](<#TransactionPartnerFragment.UnmarshalJSON>) - [type TransactionPartnerFragmentType](<#TransactionPartnerFragmentType>) - [type TransactionPartnerOther](<#TransactionPartnerOther>) + - [func \(v \*TransactionPartnerOther\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerOther.MarshalJSON>) - [type TransactionPartnerOtherType](<#TransactionPartnerOtherType>) - [type TransactionPartnerTelegramAds](<#TransactionPartnerTelegramAds>) + - [func \(v \*TransactionPartnerTelegramAds\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerTelegramAds.MarshalJSON>) - [type TransactionPartnerTelegramAdsType](<#TransactionPartnerTelegramAdsType>) - [type TransactionPartnerTelegramApi](<#TransactionPartnerTelegramApi>) + - [func \(v \*TransactionPartnerTelegramApi\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerTelegramApi.MarshalJSON>) - [type TransactionPartnerTelegramApiType](<#TransactionPartnerTelegramApiType>) - [type TransactionPartnerUser](<#TransactionPartnerUser>) + - [func \(v \*TransactionPartnerUser\) MarshalJSON\(\) \(\[\]byte, error\)](<#TransactionPartnerUser.MarshalJSON>) - [func \(m \*TransactionPartnerUser\) UnmarshalJSON\(data \[\]byte\) error](<#TransactionPartnerUser.UnmarshalJSON>) - [type TransactionPartnerUserTransactionType](<#TransactionPartnerUserTransactionType>) - [type TransferBusinessAccountStarsParams](<#TransferBusinessAccountStarsParams>) @@ -1966,7 +2065,7 @@ VerifyUser calls the verifyUser Telegram Bot API method. Verifies a user on behalf of the organization which is represented by the bot. Returns True on success. -## type [AcceptedGiftTypes]() +## type [AcceptedGiftTypes]() This object describes the types of gifts that can be gifted to a user or a chat. @@ -2004,7 +2103,7 @@ type AddStickerToSetParams struct { ``` -## type [AffiliateInfo]() +## type [AffiliateInfo]() Contains information about the affiliate that received a commission via this transaction. @@ -2024,7 +2123,7 @@ type AffiliateInfo struct { ``` -## type [Animation]() +## type [Animation]() This object represents an animation file \(GIF or H.264/MPEG\-4 AVC video without sound\). @@ -2202,7 +2301,7 @@ type ApproveSuggestedPostParams struct { ``` -## type [Audio]() +## type [Audio]() This object represents an audio file to be treated as music by the Telegram clients. @@ -2230,7 +2329,7 @@ type Audio struct { ``` -## type [BackgroundFill]() +## type [BackgroundFill]() BackgroundFill is a union type. The following concrete variants implement it: @@ -2247,7 +2346,7 @@ type BackgroundFill interface { ``` -### func [UnmarshalBackgroundFill]() +### func [UnmarshalBackgroundFill]() ```go func UnmarshalBackgroundFill(data []byte) (BackgroundFill, error) @@ -2256,7 +2355,7 @@ func UnmarshalBackgroundFill(data []byte) (BackgroundFill, error) UnmarshalBackgroundFill decodes a BackgroundFill from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [BackgroundFillFreeformGradient]() +## type [BackgroundFillFreeformGradient]() The background is a freeform gradient that rotates after every message in the chat. @@ -2269,6 +2368,15 @@ type BackgroundFillFreeformGradient struct { } ``` + +### func \(\*BackgroundFillFreeformGradient\) [MarshalJSON]() + +```go +func (v *BackgroundFillFreeformGradient) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundFillFreeformGradient with the discriminator field "type" forced to "freeform\_gradient". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [BackgroundFillFreeformGradientType]() @@ -2287,7 +2395,7 @@ const ( ``` -## type [BackgroundFillGradient]() +## type [BackgroundFillGradient]() The background is a gradient fill. @@ -2304,6 +2412,15 @@ type BackgroundFillGradient struct { } ``` + +### func \(\*BackgroundFillGradient\) [MarshalJSON]() + +```go +func (v *BackgroundFillGradient) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundFillGradient with the discriminator field "type" forced to "gradient". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [BackgroundFillGradientType]() @@ -2322,7 +2439,7 @@ const ( ``` -## type [BackgroundFillSolid]() +## type [BackgroundFillSolid]() The background is filled using the selected color. @@ -2335,6 +2452,15 @@ type BackgroundFillSolid struct { } ``` + +### func \(\*BackgroundFillSolid\) [MarshalJSON]() + +```go +func (v *BackgroundFillSolid) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundFillSolid with the discriminator field "type" forced to "solid". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [BackgroundFillSolidType]() @@ -2353,7 +2479,7 @@ const ( ``` -## type [BackgroundType]() +## type [BackgroundType]() BackgroundType is a union type. The following concrete variants implement it: @@ -2371,7 +2497,7 @@ type BackgroundType interface { ``` -### func [UnmarshalBackgroundType]() +### func [UnmarshalBackgroundType]() ```go func UnmarshalBackgroundType(data []byte) (BackgroundType, error) @@ -2380,7 +2506,7 @@ func UnmarshalBackgroundType(data []byte) (BackgroundType, error) UnmarshalBackgroundType decodes a BackgroundType from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [BackgroundTypeChatTheme]() +## type [BackgroundTypeChatTheme]() The background is taken directly from a built\-in chat theme. @@ -2393,6 +2519,15 @@ type BackgroundTypeChatTheme struct { } ``` + +### func \(\*BackgroundTypeChatTheme\) [MarshalJSON]() + +```go +func (v *BackgroundTypeChatTheme) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundTypeChatTheme with the discriminator field "type" forced to "chat\_theme". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [BackgroundTypeChatThemeType]() @@ -2411,7 +2546,7 @@ const ( ``` -## type [BackgroundTypeFill]() +## type [BackgroundTypeFill]() The background is automatically filled based on the selected colors. @@ -2426,8 +2561,17 @@ type BackgroundTypeFill struct { } ``` + +### func \(\*BackgroundTypeFill\) [MarshalJSON]() + +```go +func (v *BackgroundTypeFill) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundTypeFill with the discriminator field "type" forced to "fill". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -### func \(\*BackgroundTypeFill\) [UnmarshalJSON]() +### func \(\*BackgroundTypeFill\) [UnmarshalJSON]() ```go func (m *BackgroundTypeFill) UnmarshalJSON(data []byte) error @@ -2453,7 +2597,7 @@ const ( ``` -## type [BackgroundTypePattern]() +## type [BackgroundTypePattern]() The background is a .PNG or .TGV \(gzipped subset of SVG with MIME type “application/x\-tgwallpattern”\) pattern to be combined with the background fill chosen by the user. @@ -2474,8 +2618,17 @@ type BackgroundTypePattern struct { } ``` + +### func \(\*BackgroundTypePattern\) [MarshalJSON]() + +```go +func (v *BackgroundTypePattern) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundTypePattern with the discriminator field "type" forced to "pattern". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -### func \(\*BackgroundTypePattern\) [UnmarshalJSON]() +### func \(\*BackgroundTypePattern\) [UnmarshalJSON]() ```go func (m *BackgroundTypePattern) UnmarshalJSON(data []byte) error @@ -2501,7 +2654,7 @@ const ( ``` -## type [BackgroundTypeWallpaper]() +## type [BackgroundTypeWallpaper]() The background is a wallpaper in the JPEG format. @@ -2520,6 +2673,15 @@ type BackgroundTypeWallpaper struct { } ``` + +### func \(\*BackgroundTypeWallpaper\) [MarshalJSON]() + +```go +func (v *BackgroundTypeWallpaper) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BackgroundTypeWallpaper with the discriminator field "type" forced to "wallpaper". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [BackgroundTypeWallpaperType]() @@ -2574,7 +2736,7 @@ type BanChatSenderChatParams struct { ``` -## type [Birthdate]() +## type [Birthdate]() Describes the birthdate of a user. @@ -2590,7 +2752,7 @@ type Birthdate struct { ``` -## type [BotAccessSettings]() +## type [BotAccessSettings]() This object describes the access settings of a bot. @@ -2615,7 +2777,7 @@ GetManagedBotAccessSettings calls the getManagedBotAccessSettings Telegram Bot A Use this method to get the access settings of a managed bot. Returns a BotAccessSettings object on success. -## type [BotCommand]() +## type [BotCommand]() This object represents a bot command. @@ -2640,7 +2802,7 @@ GetMyCommands calls the getMyCommands Telegram Bot API method. Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned. -## type [BotCommandScope]() +## type [BotCommandScope]() BotCommandScope is a union type. The following concrete variants implement it: @@ -2661,7 +2823,7 @@ type BotCommandScope interface { ``` -## type [BotCommandScopeAllChatAdministrators]() +## type [BotCommandScopeAllChatAdministrators]() Represents the scope of bot commands, covering all group and supergroup chat administrators. @@ -2672,8 +2834,17 @@ type BotCommandScopeAllChatAdministrators struct { } ``` + +### func \(\*BotCommandScopeAllChatAdministrators\) [MarshalJSON]() + +```go +func (v *BotCommandScopeAllChatAdministrators) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeAllChatAdministrators with the discriminator field "type" forced to "all\_chat\_administrators". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotCommandScopeAllGroupChats]() +## type [BotCommandScopeAllGroupChats]() Represents the scope of bot commands, covering all group and supergroup chats. @@ -2684,8 +2855,17 @@ type BotCommandScopeAllGroupChats struct { } ``` + +### func \(\*BotCommandScopeAllGroupChats\) [MarshalJSON]() + +```go +func (v *BotCommandScopeAllGroupChats) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeAllGroupChats with the discriminator field "type" forced to "all\_group\_chats". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotCommandScopeAllPrivateChats]() +## type [BotCommandScopeAllPrivateChats]() Represents the scope of bot commands, covering all private chats. @@ -2696,8 +2876,17 @@ type BotCommandScopeAllPrivateChats struct { } ``` + +### func \(\*BotCommandScopeAllPrivateChats\) [MarshalJSON]() + +```go +func (v *BotCommandScopeAllPrivateChats) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeAllPrivateChats with the discriminator field "type" forced to "all\_private\_chats". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotCommandScopeChat]() +## type [BotCommandScopeChat]() Represents the scope of bot commands, covering a specific chat. @@ -2710,8 +2899,17 @@ type BotCommandScopeChat struct { } ``` + +### func \(\*BotCommandScopeChat\) [MarshalJSON]() + +```go +func (v *BotCommandScopeChat) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeChat with the discriminator field "type" forced to "chat". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotCommandScopeChatAdministrators]() +## type [BotCommandScopeChatAdministrators]() Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. @@ -2724,8 +2922,17 @@ type BotCommandScopeChatAdministrators struct { } ``` + +### func \(\*BotCommandScopeChatAdministrators\) [MarshalJSON]() + +```go +func (v *BotCommandScopeChatAdministrators) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeChatAdministrators with the discriminator field "type" forced to "chat\_administrators". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotCommandScopeChatMember]() +## type [BotCommandScopeChatMember]() Represents the scope of bot commands, covering a specific member of a group or supergroup chat. @@ -2740,8 +2947,17 @@ type BotCommandScopeChatMember struct { } ``` + +### func \(\*BotCommandScopeChatMember\) [MarshalJSON]() + +```go +func (v *BotCommandScopeChatMember) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeChatMember with the discriminator field "type" forced to "chat\_member". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotCommandScopeDefault]() +## type [BotCommandScopeDefault]() Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. @@ -2752,8 +2968,17 @@ type BotCommandScopeDefault struct { } ``` + +### func \(\*BotCommandScopeDefault\) [MarshalJSON]() + +```go +func (v *BotCommandScopeDefault) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes BotCommandScopeDefault with the discriminator field "type" forced to "default". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [BotDescription]() +## type [BotDescription]() This object represents the bot's description. @@ -2776,7 +3001,7 @@ GetMyDescription calls the getMyDescription Telegram Bot API method. Use this method to get the current bot description for the given user language. Returns BotDescription on success. -## type [BotName]() +## type [BotName]() This object represents the bot's name. @@ -2799,7 +3024,7 @@ GetMyName calls the getMyName Telegram Bot API method. Use this method to get the current bot name for the given user language. Returns BotName on success. -## type [BotShortDescription]() +## type [BotShortDescription]() This object represents the bot's short description. @@ -2822,7 +3047,7 @@ GetMyShortDescription calls the getMyShortDescription Telegram Bot API method. Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success. -## type [BusinessBotRights]() +## type [BusinessBotRights]() Represents the rights of a business bot. @@ -2860,7 +3085,7 @@ type BusinessBotRights struct { ``` -## type [BusinessConnection]() +## type [BusinessConnection]() Describes the connection of the bot with a business account. @@ -2893,7 +3118,7 @@ GetBusinessConnection calls the getBusinessConnection Telegram Bot API method. Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success. -## type [BusinessIntro]() +## type [BusinessIntro]() Contains information about the start page settings of a Telegram Business account. @@ -2909,7 +3134,7 @@ type BusinessIntro struct { ``` -## type [BusinessLocation]() +## type [BusinessLocation]() Contains information about the location of a Telegram Business account. @@ -2923,7 +3148,7 @@ type BusinessLocation struct { ``` -## type [BusinessMessagesDeleted]() +## type [BusinessMessagesDeleted]() This object is received when messages are deleted from a connected business account. @@ -2939,7 +3164,7 @@ type BusinessMessagesDeleted struct { ``` -## type [BusinessOpeningHours]() +## type [BusinessOpeningHours]() Describes the opening hours of a business. @@ -2953,7 +3178,7 @@ type BusinessOpeningHours struct { ``` -## type [BusinessOpeningHoursInterval]() +## type [BusinessOpeningHoursInterval]() Describes an interval of time during which a business is open. @@ -2967,7 +3192,7 @@ type BusinessOpeningHoursInterval struct { ``` -## type [CallbackGame]() +## type [CallbackGame]() A placeholder, currently holds no information. Use BotFather to set up your game. @@ -2977,7 +3202,7 @@ type CallbackGame struct { ``` -## type [CallbackQuery]() +## type [CallbackQuery]() This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot \(in inline mode\), the field inline\_message\_id will be present. Exactly one of the fields data or game\_short\_name will be present. NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed \(e.g., without specifying any of the optional parameters\). @@ -3001,7 +3226,7 @@ type CallbackQuery struct { ``` -### func \(\*CallbackQuery\) [UnmarshalJSON]() +### func \(\*CallbackQuery\) [UnmarshalJSON]() ```go func (m *CallbackQuery) UnmarshalJSON(data []byte) error @@ -3036,7 +3261,7 @@ type Chat struct { ``` -## type [ChatAdministratorRights]() +## type [ChatAdministratorRights]() Represents the rights of an administrator in a chat. @@ -3091,7 +3316,7 @@ GetMyDefaultAdministratorRights calls the getMyDefaultAdministratorRights Telegr Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success. -## type [ChatBackground]() +## type [ChatBackground]() This object represents a chat background. @@ -3103,7 +3328,7 @@ type ChatBackground struct { ``` -### func \(\*ChatBackground\) [UnmarshalJSON]() +### func \(\*ChatBackground\) [UnmarshalJSON]() ```go func (m *ChatBackground) UnmarshalJSON(data []byte) error @@ -3112,7 +3337,7 @@ func (m *ChatBackground) UnmarshalJSON(data []byte) error UnmarshalJSON decodes ChatBackground by dispatching union\-typed fields \(Type\) through their concrete UnmarshalXxx helpers. -## type [ChatBoost]() +## type [ChatBoost]() This object contains information about a chat boost. @@ -3130,7 +3355,7 @@ type ChatBoost struct { ``` -### func \(\*ChatBoost\) [UnmarshalJSON]() +### func \(\*ChatBoost\) [UnmarshalJSON]() ```go func (m *ChatBoost) UnmarshalJSON(data []byte) error @@ -3139,7 +3364,7 @@ func (m *ChatBoost) UnmarshalJSON(data []byte) error UnmarshalJSON decodes ChatBoost by dispatching union\-typed fields \(Source\) through their concrete UnmarshalXxx helpers. -## type [ChatBoostAdded]() +## type [ChatBoostAdded]() This object represents a service message about a user boosting a chat. @@ -3151,7 +3376,7 @@ type ChatBoostAdded struct { ``` -## type [ChatBoostRemoved]() +## type [ChatBoostRemoved]() This object represents a boost removed from a chat. @@ -3169,7 +3394,7 @@ type ChatBoostRemoved struct { ``` -### func \(\*ChatBoostRemoved\) [UnmarshalJSON]() +### func \(\*ChatBoostRemoved\) [UnmarshalJSON]() ```go func (m *ChatBoostRemoved) UnmarshalJSON(data []byte) error @@ -3178,7 +3403,7 @@ func (m *ChatBoostRemoved) UnmarshalJSON(data []byte) error UnmarshalJSON decodes ChatBoostRemoved by dispatching union\-typed fields \(Source\) through their concrete UnmarshalXxx helpers. -## type [ChatBoostSource]() +## type [ChatBoostSource]() ChatBoostSource is a union type. The following concrete variants implement it: @@ -3195,7 +3420,7 @@ type ChatBoostSource interface { ``` -### func [UnmarshalChatBoostSource]() +### func [UnmarshalChatBoostSource]() ```go func UnmarshalChatBoostSource(data []byte) (ChatBoostSource, error) @@ -3204,7 +3429,7 @@ func UnmarshalChatBoostSource(data []byte) (ChatBoostSource, error) UnmarshalChatBoostSource decodes a ChatBoostSource from JSON by inspecting the "source" field and dispatching to the correct concrete type. -## type [ChatBoostSourceGiftCode]() +## type [ChatBoostSourceGiftCode]() The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. @@ -3217,6 +3442,15 @@ type ChatBoostSourceGiftCode struct { } ``` + +### func \(\*ChatBoostSourceGiftCode\) [MarshalJSON]() + +```go +func (v *ChatBoostSourceGiftCode) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatBoostSourceGiftCode with the discriminator field "source" forced to "gift\_code". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatBoostSourceGiftCodeSource]() @@ -3235,7 +3469,7 @@ const ( ``` -## type [ChatBoostSourceGiveaway]() +## type [ChatBoostSourceGiveaway]() The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize\_star\_count / 500 times for one year for Telegram Star giveaways. @@ -3254,6 +3488,15 @@ type ChatBoostSourceGiveaway struct { } ``` + +### func \(\*ChatBoostSourceGiveaway\) [MarshalJSON]() + +```go +func (v *ChatBoostSourceGiveaway) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatBoostSourceGiveaway with the discriminator field "source" forced to "giveaway". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatBoostSourceGiveawaySource]() @@ -3272,7 +3515,7 @@ const ( ``` -## type [ChatBoostSourcePremium]() +## type [ChatBoostSourcePremium]() The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. @@ -3285,6 +3528,15 @@ type ChatBoostSourcePremium struct { } ``` + +### func \(\*ChatBoostSourcePremium\) [MarshalJSON]() + +```go +func (v *ChatBoostSourcePremium) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatBoostSourcePremium with the discriminator field "source" forced to "premium". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatBoostSourcePremiumSource]() @@ -3303,7 +3555,7 @@ const ( ``` -## type [ChatBoostUpdated]() +## type [ChatBoostUpdated]() This object represents a boost added to a chat or changed. @@ -3514,7 +3766,7 @@ func (c *ChatID) UnmarshalJSON(data []byte) error UnmarshalJSON accepts either a JSON number or a JSON string. -## type [ChatInviteLink]() +## type [ChatInviteLink]() Represents an invite link for a chat. @@ -3601,7 +3853,7 @@ RevokeChatInviteLink calls the revokeChatInviteLink Telegram Bot API method. Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object. -## type [ChatJoinRequest]() +## type [ChatJoinRequest]() Represents a join request sent to a chat. @@ -3623,7 +3875,7 @@ type ChatJoinRequest struct { ``` -## type [ChatLocation]() +## type [ChatLocation]() Represents a location to which a chat is connected. @@ -3637,7 +3889,7 @@ type ChatLocation struct { ``` -## type [ChatMember]() +## type [ChatMember]() ChatMember is a union type. The following concrete variants implement it: @@ -3679,7 +3931,7 @@ GetChatMember calls the getChatMember Telegram Bot API method. Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success. -### func [UnmarshalChatMember]() +### func [UnmarshalChatMember]() ```go func UnmarshalChatMember(data []byte) (ChatMember, error) @@ -3688,7 +3940,7 @@ func UnmarshalChatMember(data []byte) (ChatMember, error) UnmarshalChatMember decodes a ChatMember from JSON by inspecting the "status" field and dispatching to the correct concrete type. -## type [ChatMemberAdministrator]() +## type [ChatMemberAdministrator]() Represents a chat member that has some additional privileges. @@ -3739,6 +3991,15 @@ type ChatMemberAdministrator struct { } ``` + +### func \(\*ChatMemberAdministrator\) [MarshalJSON]() + +```go +func (v *ChatMemberAdministrator) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatMemberAdministrator with the discriminator field "status" forced to "administrator". The hardcoded value frees callers from setting Status by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatMemberAdministratorStatus]() @@ -3757,7 +4018,7 @@ const ( ``` -## type [ChatMemberBanned]() +## type [ChatMemberBanned]() Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. @@ -3772,6 +4033,15 @@ type ChatMemberBanned struct { } ``` + +### func \(\*ChatMemberBanned\) [MarshalJSON]() + +```go +func (v *ChatMemberBanned) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatMemberBanned with the discriminator field "status" forced to "kicked". The hardcoded value frees callers from setting Status by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatMemberBannedStatus]() @@ -3790,7 +4060,7 @@ const ( ``` -## type [ChatMemberLeft]() +## type [ChatMemberLeft]() Represents a chat member that isn't currently a member of the chat, but may join it themselves. @@ -3803,6 +4073,15 @@ type ChatMemberLeft struct { } ``` + +### func \(\*ChatMemberLeft\) [MarshalJSON]() + +```go +func (v *ChatMemberLeft) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatMemberLeft with the discriminator field "status" forced to "left". The hardcoded value frees callers from setting Status by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatMemberLeftStatus]() @@ -3821,7 +4100,7 @@ const ( ``` -## type [ChatMemberMember]() +## type [ChatMemberMember]() Represents a chat member that has no additional privileges or restrictions. @@ -3838,6 +4117,15 @@ type ChatMemberMember struct { } ``` + +### func \(\*ChatMemberMember\) [MarshalJSON]() + +```go +func (v *ChatMemberMember) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatMemberMember with the discriminator field "status" forced to "member". The hardcoded value frees callers from setting Status by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatMemberMemberStatus]() @@ -3856,7 +4144,7 @@ const ( ``` -## type [ChatMemberOwner]() +## type [ChatMemberOwner]() Represents a chat member that owns the chat and has all administrator privileges. @@ -3873,6 +4161,15 @@ type ChatMemberOwner struct { } ``` + +### func \(\*ChatMemberOwner\) [MarshalJSON]() + +```go +func (v *ChatMemberOwner) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatMemberOwner with the discriminator field "status" forced to "creator". The hardcoded value frees callers from setting Status by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatMemberOwnerStatus]() @@ -3891,7 +4188,7 @@ const ( ``` -## type [ChatMemberRestricted]() +## type [ChatMemberRestricted]() Represents a chat member that is under certain restrictions in the chat. Supergroups only. @@ -3942,6 +4239,15 @@ type ChatMemberRestricted struct { } ``` + +### func \(\*ChatMemberRestricted\) [MarshalJSON]() + +```go +func (v *ChatMemberRestricted) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ChatMemberRestricted with the discriminator field "status" forced to "restricted". The hardcoded value frees callers from setting Status by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ChatMemberRestrictedStatus]() @@ -3960,7 +4266,7 @@ const ( ``` -## type [ChatMemberUpdated]() +## type [ChatMemberUpdated]() This object represents changes in the status of a chat member. @@ -3986,7 +4292,7 @@ type ChatMemberUpdated struct { ``` -### func \(\*ChatMemberUpdated\) [UnmarshalJSON]() +### func \(\*ChatMemberUpdated\) [UnmarshalJSON]() ```go func (m *ChatMemberUpdated) UnmarshalJSON(data []byte) error @@ -3995,7 +4301,7 @@ func (m *ChatMemberUpdated) UnmarshalJSON(data []byte) error UnmarshalJSON decodes ChatMemberUpdated by dispatching union\-typed fields \(OldChatMember, NewChatMember\) through their concrete UnmarshalXxx helpers. -## type [ChatOwnerChanged]() +## type [ChatOwnerChanged]() Describes a service message about an ownership change in the chat. @@ -4007,7 +4313,7 @@ type ChatOwnerChanged struct { ``` -## type [ChatOwnerLeft]() +## type [ChatOwnerLeft]() Describes a service message about the chat owner leaving the chat. @@ -4019,7 +4325,7 @@ type ChatOwnerLeft struct { ``` -## type [ChatPermissions]() +## type [ChatPermissions]() Describes actions that a non\-administrator user is allowed to take in a chat. @@ -4061,7 +4367,7 @@ type ChatPermissions struct { ``` -## type [ChatPhoto]() +## type [ChatPhoto]() This object represents a chat photo. @@ -4079,7 +4385,7 @@ type ChatPhoto struct { ``` -## type [ChatShared]() +## type [ChatShared]() This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button. @@ -4119,7 +4425,7 @@ const ( ``` -## type [Checklist]() +## type [Checklist]() Describes a checklist. @@ -4139,7 +4445,7 @@ type Checklist struct { ``` -## type [ChecklistTask]() +## type [ChecklistTask]() Describes a task in a checklist. @@ -4161,7 +4467,7 @@ type ChecklistTask struct { ``` -## type [ChecklistTasksAdded]() +## type [ChecklistTasksAdded]() Describes a service message about tasks added to a checklist. @@ -4175,7 +4481,7 @@ type ChecklistTasksAdded struct { ``` -## type [ChecklistTasksDone]() +## type [ChecklistTasksDone]() Describes a service message about checklist tasks marked as done or not done. @@ -4191,7 +4497,7 @@ type ChecklistTasksDone struct { ``` -## type [ChosenInlineResult]() +## type [ChosenInlineResult]() Represents a result of an inline query that was chosen by the user and sent to their chat partner. Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. @@ -4253,7 +4559,7 @@ type CloseParams struct { ``` -## type [Contact]() +## type [Contact]() This object represents a phone contact. @@ -4363,7 +4669,7 @@ type CopyMessagesParams struct { ``` -## type [CopyTextButton]() +## type [CopyTextButton]() This object represents an inline keyboard button that copies specified text to the clipboard. @@ -4755,7 +5061,7 @@ type DeleteWebhookParams struct { ``` -## type [Dice]() +## type [Dice]() This object represents an animated emoji that displays a random value. @@ -4769,7 +5075,7 @@ type Dice struct { ``` -## type [DirectMessagePriceChanged]() +## type [DirectMessagePriceChanged]() Describes a service message about a change in the price of direct messages sent to a channel chat. @@ -4783,7 +5089,7 @@ type DirectMessagePriceChanged struct { ``` -## type [DirectMessagesTopic]() +## type [DirectMessagesTopic]() Describes a topic of a direct messages chat. @@ -4797,7 +5103,7 @@ type DirectMessagesTopic struct { ``` -## type [Document]() +## type [Document]() This object represents a general file \(as opposed to photos, voice messages and audio files\). @@ -5130,7 +5436,7 @@ type EditUserStarSubscriptionParams struct { ``` -## type [EncryptedCredentials]() +## type [EncryptedCredentials]() Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. @@ -5146,7 +5452,7 @@ type EncryptedCredentials struct { ``` -## type [EncryptedPassportElement]() +## type [EncryptedPassportElement]() Describes documents or other Telegram Passport elements shared with the bot by the user. @@ -5290,7 +5596,7 @@ func (m *ExternalReplyInfo) UnmarshalJSON(data []byte) error UnmarshalJSON decodes ExternalReplyInfo by dispatching union\-typed fields \(Origin\) through their concrete UnmarshalXxx helpers. -## type [File]() +## type [File]() This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot\/\. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. The maximum file size to download is 20 MB @@ -5343,7 +5649,7 @@ UploadStickerFile calls the uploadStickerFile Telegram Bot API method. Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods \(the file can be used multiple times\). Returns the uploaded File on success. -## type [ForceReply]() +## type [ForceReply]() Upon receiving a message with this object, Telegram clients will display a reply interface to the user \(act as if the user has selected the bot's message and tapped 'Reply'\). This can be extremely useful if you want to create user\-friendly step\-by\-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a user account. Example: A poll bot for groups runs in privacy mode \(only receives commands, replies to its messages and mentions\). There could be two ways to create a new poll: The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions \- without any extra work for the user. @@ -5359,7 +5665,7 @@ type ForceReply struct { ``` -## type [ForumTopic]() +## type [ForumTopic]() This object represents a forum topic. @@ -5390,7 +5696,7 @@ CreateForumTopic calls the createForumTopic Telegram Bot API method. Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can\_manage\_topics administrator right. Returns information about the created topic as a ForumTopic object. -## type [ForumTopicClosed]() +## type [ForumTopicClosed]() This object represents a service message about a forum topic closed in the chat. Currently holds no information. @@ -5400,7 +5706,7 @@ type ForumTopicClosed struct { ``` -## type [ForumTopicCreated]() +## type [ForumTopicCreated]() This object represents a service message about a new forum topic created in the chat. @@ -5418,7 +5724,7 @@ type ForumTopicCreated struct { ``` -## type [ForumTopicEdited]() +## type [ForumTopicEdited]() This object represents a service message about an edited forum topic. @@ -5432,7 +5738,7 @@ type ForumTopicEdited struct { ``` -## type [ForumTopicReopened]() +## type [ForumTopicReopened]() This object represents a service message about a forum topic reopened in the chat. Currently holds no information. @@ -5500,7 +5806,7 @@ type ForwardMessagesParams struct { ``` -## type [Game]() +## type [Game]() This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. @@ -5522,7 +5828,7 @@ type Game struct { ``` -## type [GameHighScore]() +## type [GameHighScore]() This object represents one row of the high scores table for a game. And that's about all we've got for now.If you've got any questions, please check out our Bot FAQ » @@ -5549,7 +5855,7 @@ GetGameHighScores calls the getGameHighScores Telegram Bot API method. Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change. -## type [GeneralForumTopicHidden]() +## type [GeneralForumTopicHidden]() This object represents a service message about General forum topic hidden in the chat. Currently holds no information. @@ -5559,7 +5865,7 @@ type GeneralForumTopicHidden struct { ``` -## type [GeneralForumTopicUnhidden]() +## type [GeneralForumTopicUnhidden]() This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. @@ -6095,7 +6401,7 @@ type GetWebhookInfoParams struct { ``` -## type [Gift]() +## type [Gift]() This object represents a gift that can be sent by the bot. @@ -6131,7 +6437,7 @@ type Gift struct { ``` -## type [GiftBackground]() +## type [GiftBackground]() This object describes the background of a gift. @@ -6147,7 +6453,7 @@ type GiftBackground struct { ``` -## type [GiftInfo]() +## type [GiftInfo]() Describes a service message about a regular gift that was sent or received. @@ -6201,7 +6507,7 @@ type GiftPremiumSubscriptionParams struct { ``` -## type [Gifts]() +## type [Gifts]() This object represent a list of gifts. @@ -6224,7 +6530,7 @@ GetAvailableGifts calls the getAvailableGifts Telegram Bot API method. Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object. -## type [Giveaway]() +## type [Giveaway]() This object represents a message about a scheduled giveaway. @@ -6252,7 +6558,7 @@ type Giveaway struct { ``` -## type [GiveawayCompleted]() +## type [GiveawayCompleted]() This object represents a service message about the completion of a giveaway without public winners. @@ -6270,7 +6576,7 @@ type GiveawayCompleted struct { ``` -## type [GiveawayCreated]() +## type [GiveawayCreated]() This object represents a service message about the creation of a scheduled giveaway. @@ -6282,7 +6588,7 @@ type GiveawayCreated struct { ``` -## type [GiveawayWinners]() +## type [GiveawayWinners]() This object represents a message about the completion of a giveaway with public winners. @@ -6346,7 +6652,7 @@ type InaccessibleMessage struct { ``` -## type [InlineKeyboardButton]() +## type [InlineKeyboardButton]() This object represents one button of an inline keyboard. Exactly one of the fields other than text, icon\_custom\_emoji\_id, and style must be used to specify the type of the button. @@ -6382,7 +6688,7 @@ type InlineKeyboardButton struct { ``` -## type [InlineKeyboardMarkup]() +## type [InlineKeyboardMarkup]() This object represents an inline keyboard that appears right next to the message it belongs to. @@ -6394,7 +6700,7 @@ type InlineKeyboardMarkup struct { ``` -## type [InlineQuery]() +## type [InlineQuery]() This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. @@ -6437,7 +6743,7 @@ const ( ``` -## type [InlineQueryResult]() +## type [InlineQueryResult]() InlineQueryResult is a union type. The following concrete variants implement it: @@ -6471,7 +6777,7 @@ type InlineQueryResult interface { ``` -## type [InlineQueryResultArticle]() +## type [InlineQueryResultArticle]() Represents a link to an article or web page. @@ -6500,8 +6806,17 @@ type InlineQueryResultArticle struct { } ``` + +### func \(\*InlineQueryResultArticle\) [MarshalJSON]() + +```go +func (v *InlineQueryResultArticle) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultArticle with the discriminator field "type" forced to "article". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultAudio]() +## type [InlineQueryResultAudio]() Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the audio. @@ -6532,8 +6847,17 @@ type InlineQueryResultAudio struct { } ``` + +### func \(\*InlineQueryResultAudio\) [MarshalJSON]() + +```go +func (v *InlineQueryResultAudio) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultAudio with the discriminator field "type" forced to "audio". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedAudio]() +## type [InlineQueryResultCachedAudio]() Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the audio. @@ -6558,8 +6882,17 @@ type InlineQueryResultCachedAudio struct { } ``` + +### func \(\*InlineQueryResultCachedAudio\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedAudio) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedAudio with the discriminator field "type" forced to "audio". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedDocument]() +## type [InlineQueryResultCachedDocument]() Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the file. @@ -6588,8 +6921,17 @@ type InlineQueryResultCachedDocument struct { } ``` + +### func \(\*InlineQueryResultCachedDocument\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedDocument) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedDocument with the discriminator field "type" forced to "document". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedGif]() +## type [InlineQueryResultCachedGif]() Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with specified content instead of the animation. @@ -6618,8 +6960,17 @@ type InlineQueryResultCachedGif struct { } ``` + +### func \(\*InlineQueryResultCachedGif\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedGif) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedGif with the discriminator field "type" forced to "gif". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedMpeg4Gif]() +## type [InlineQueryResultCachedMpeg4Gif]() Represents a link to a video animation \(H.264/MPEG\-4 AVC video without sound\) stored on the Telegram servers. By default, this animated MPEG\-4 file will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the animation. @@ -6648,8 +6999,17 @@ type InlineQueryResultCachedMpeg4Gif struct { } ``` + +### func \(\*InlineQueryResultCachedMpeg4Gif\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedMpeg4Gif) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedMpeg4Gif with the discriminator field "type" forced to "mpeg4\_gif". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedPhoto]() +## type [InlineQueryResultCachedPhoto]() Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the photo. @@ -6680,8 +7040,17 @@ type InlineQueryResultCachedPhoto struct { } ``` + +### func \(\*InlineQueryResultCachedPhoto\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedPhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedPhoto with the discriminator field "type" forced to "photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedSticker]() +## type [InlineQueryResultCachedSticker]() Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the sticker. @@ -6700,8 +7069,17 @@ type InlineQueryResultCachedSticker struct { } ``` + +### func \(\*InlineQueryResultCachedSticker\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedSticker) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedSticker with the discriminator field "type" forced to "sticker". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedVideo]() +## type [InlineQueryResultCachedVideo]() Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the video. @@ -6732,8 +7110,17 @@ type InlineQueryResultCachedVideo struct { } ``` + +### func \(\*InlineQueryResultCachedVideo\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedVideo) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedVideo with the discriminator field "type" forced to "video". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultCachedVoice]() +## type [InlineQueryResultCachedVoice]() Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the voice message. @@ -6760,8 +7147,17 @@ type InlineQueryResultCachedVoice struct { } ``` + +### func \(\*InlineQueryResultCachedVoice\) [MarshalJSON]() + +```go +func (v *InlineQueryResultCachedVoice) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultCachedVoice with the discriminator field "type" forced to "voice". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultContact]() +## type [InlineQueryResultContact]() Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the contact. @@ -6792,8 +7188,17 @@ type InlineQueryResultContact struct { } ``` + +### func \(\*InlineQueryResultContact\) [MarshalJSON]() + +```go +func (v *InlineQueryResultContact) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultContact with the discriminator field "type" forced to "contact". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultDocument]() +## type [InlineQueryResultDocument]() Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. @@ -6830,6 +7235,15 @@ type InlineQueryResultDocument struct { } ``` + +### func \(\*InlineQueryResultDocument\) [MarshalJSON]() + +```go +func (v *InlineQueryResultDocument) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultDocument with the discriminator field "type" forced to "document". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [InlineQueryResultDocumentMimeType]() @@ -6849,7 +7263,7 @@ const ( ``` -## type [InlineQueryResultGame]() +## type [InlineQueryResultGame]() Represents a Game. @@ -6866,8 +7280,17 @@ type InlineQueryResultGame struct { } ``` + +### func \(\*InlineQueryResultGame\) [MarshalJSON]() + +```go +func (v *InlineQueryResultGame) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultGame with the discriminator field "type" forced to "game". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultGif]() +## type [InlineQueryResultGif]() Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the animation. @@ -6906,6 +7329,15 @@ type InlineQueryResultGif struct { } ``` + +### func \(\*InlineQueryResultGif\) [MarshalJSON]() + +```go +func (v *InlineQueryResultGif) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultGif with the discriminator field "type" forced to "gif". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [InlineQueryResultGifThumbnailMimeType]() @@ -6926,7 +7358,7 @@ const ( ``` -## type [InlineQueryResultLocation]() +## type [InlineQueryResultLocation]() Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the location. @@ -6963,8 +7395,17 @@ type InlineQueryResultLocation struct { } ``` + +### func \(\*InlineQueryResultLocation\) [MarshalJSON]() + +```go +func (v *InlineQueryResultLocation) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultLocation with the discriminator field "type" forced to "location". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultMpeg4Gif]() +## type [InlineQueryResultMpeg4Gif]() Represents a link to a video animation \(H.264/MPEG\-4 AVC video without sound\). By default, this animated MPEG\-4 file will be sent by the user with optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the animation. @@ -7003,8 +7444,17 @@ type InlineQueryResultMpeg4Gif struct { } ``` + +### func \(\*InlineQueryResultMpeg4Gif\) [MarshalJSON]() + +```go +func (v *InlineQueryResultMpeg4Gif) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultMpeg4Gif with the discriminator field "type" forced to "mpeg4\_gif". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultPhoto]() +## type [InlineQueryResultPhoto]() Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the photo. @@ -7041,8 +7491,17 @@ type InlineQueryResultPhoto struct { } ``` + +### func \(\*InlineQueryResultPhoto\) [MarshalJSON]() + +```go +func (v *InlineQueryResultPhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultPhoto with the discriminator field "type" forced to "photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultVenue]() +## type [InlineQueryResultVenue]() Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the venue. @@ -7081,8 +7540,17 @@ type InlineQueryResultVenue struct { } ``` + +### func \(\*InlineQueryResultVenue\) [MarshalJSON]() + +```go +func (v *InlineQueryResultVenue) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultVenue with the discriminator field "type" forced to "venue". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultVideo]() +## type [InlineQueryResultVideo]() Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the video. If an InlineQueryResultVideo message contains an embedded video \(e.g., YouTube\), you must replace its content using input\_message\_content. @@ -7123,8 +7591,17 @@ type InlineQueryResultVideo struct { } ``` + +### func \(\*InlineQueryResultVideo\) [MarshalJSON]() + +```go +func (v *InlineQueryResultVideo) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultVideo with the discriminator field "type" forced to "video". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultVoice]() +## type [InlineQueryResultVoice]() Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input\_message\_content to send a message with the specified content instead of the the voice message. @@ -7153,8 +7630,17 @@ type InlineQueryResultVoice struct { } ``` + +### func \(\*InlineQueryResultVoice\) [MarshalJSON]() + +```go +func (v *InlineQueryResultVoice) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InlineQueryResultVoice with the discriminator field "type" forced to "voice". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InlineQueryResultsButton]() +## type [InlineQueryResultsButton]() This object represents a button to be shown above inline query results. You must use exactly one of the optional fields. @@ -7170,7 +7656,7 @@ type InlineQueryResultsButton struct { ``` -## type [InputChecklist]() +## type [InputChecklist]() Describes a checklist to create. @@ -7192,7 +7678,7 @@ type InputChecklist struct { ``` -## type [InputChecklistTask]() +## type [InputChecklistTask]() Describes a task to add to a checklist. @@ -7210,7 +7696,7 @@ type InputChecklistTask struct { ``` -## type [InputContactMessageContent]() +## type [InputContactMessageContent]() Represents the content of a contact message to be sent as the result of an inline query. @@ -7255,7 +7741,7 @@ func (f *InputFile) IsLocalUpload() bool IsLocalUpload reports whether this InputFile triggers a multipart upload. -## type [InputInvoiceMessageContent]() +## type [InputInvoiceMessageContent]() Represents the content of an invoice message to be sent as the result of an inline query. @@ -7305,7 +7791,7 @@ type InputInvoiceMessageContent struct { ``` -## type [InputLocationMessageContent]() +## type [InputLocationMessageContent]() Represents the content of a location message to be sent as the result of an inline query. @@ -7327,7 +7813,7 @@ type InputLocationMessageContent struct { ``` -## type [InputMedia]() +## type [InputMedia]() InputMedia is a union type. The following concrete variants implement it: @@ -7347,7 +7833,7 @@ type InputMedia interface { ``` -## type [InputMediaAnimation]() +## type [InputMediaAnimation]() Represents an animation file \(GIF or H.264/MPEG\-4 AVC video without sound\) to be sent. @@ -7378,8 +7864,17 @@ type InputMediaAnimation struct { } ``` + +### func \(\*InputMediaAnimation\) [MarshalJSON]() + +```go +func (v *InputMediaAnimation) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaAnimation with the discriminator field "type" forced to "animation". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaAudio]() +## type [InputMediaAudio]() Represents an audio file to be treated as music to be sent. @@ -7406,8 +7901,17 @@ type InputMediaAudio struct { } ``` + +### func \(\*InputMediaAudio\) [MarshalJSON]() + +```go +func (v *InputMediaAudio) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaAudio with the discriminator field "type" forced to "audio". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaDocument]() +## type [InputMediaDocument]() Represents a general file to be sent. @@ -7430,8 +7934,17 @@ type InputMediaDocument struct { } ``` + +### func \(\*InputMediaDocument\) [MarshalJSON]() + +```go +func (v *InputMediaDocument) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaDocument with the discriminator field "type" forced to "document". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaLivePhoto]() +## type [InputMediaLivePhoto]() Represents a live photo to be sent. @@ -7456,8 +7969,17 @@ type InputMediaLivePhoto struct { } ``` + +### func \(\*InputMediaLivePhoto\) [MarshalJSON]() + +```go +func (v *InputMediaLivePhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaLivePhoto with the discriminator field "type" forced to "live\_photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaLocation]() +## type [InputMediaLocation]() Represents a location to be sent. @@ -7474,8 +7996,17 @@ type InputMediaLocation struct { } ``` + +### func \(\*InputMediaLocation\) [MarshalJSON]() + +```go +func (v *InputMediaLocation) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaLocation with the discriminator field "type" forced to "location". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaPhoto]() +## type [InputMediaPhoto]() Represents a photo to be sent. @@ -7498,8 +8029,17 @@ type InputMediaPhoto struct { } ``` + +### func \(\*InputMediaPhoto\) [MarshalJSON]() + +```go +func (v *InputMediaPhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaPhoto with the discriminator field "type" forced to "photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaSticker]() +## type [InputMediaSticker]() Represents a sticker file to be sent. @@ -7514,8 +8054,17 @@ type InputMediaSticker struct { } ``` + +### func \(\*InputMediaSticker\) [MarshalJSON]() + +```go +func (v *InputMediaSticker) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaSticker with the discriminator field "type" forced to "sticker". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaVenue]() +## type [InputMediaVenue]() Represents a venue to be sent. @@ -7542,8 +8091,17 @@ type InputMediaVenue struct { } ``` + +### func \(\*InputMediaVenue\) [MarshalJSON]() + +```go +func (v *InputMediaVenue) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaVenue with the discriminator field "type" forced to "venue". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMediaVideo]() +## type [InputMediaVideo]() Represents a video to be sent. @@ -7580,8 +8138,17 @@ type InputMediaVideo struct { } ``` + +### func \(\*InputMediaVideo\) [MarshalJSON]() + +```go +func (v *InputMediaVideo) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputMediaVideo with the discriminator field "type" forced to "video". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputMessageContent]() +## type [InputMessageContent]() InputMessageContent is a union type. The following concrete variants implement it: @@ -7600,7 +8167,7 @@ type InputMessageContent interface { ``` -## type [InputPaidMedia]() +## type [InputPaidMedia]() InputPaidMedia is a union type. The following concrete variants implement it: @@ -7617,7 +8184,7 @@ type InputPaidMedia interface { ``` -## type [InputPaidMediaLivePhoto]() +## type [InputPaidMediaLivePhoto]() The paid media to send is a live photo. @@ -7632,8 +8199,17 @@ type InputPaidMediaLivePhoto struct { } ``` + +### func \(\*InputPaidMediaLivePhoto\) [MarshalJSON]() + +```go +func (v *InputPaidMediaLivePhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputPaidMediaLivePhoto with the discriminator field "type" forced to "live\_photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputPaidMediaPhoto]() +## type [InputPaidMediaPhoto]() The paid media to send is a photo. @@ -7646,8 +8222,17 @@ type InputPaidMediaPhoto struct { } ``` + +### func \(\*InputPaidMediaPhoto\) [MarshalJSON]() + +```go +func (v *InputPaidMediaPhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputPaidMediaPhoto with the discriminator field "type" forced to "photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputPaidMediaVideo]() +## type [InputPaidMediaVideo]() The paid media to send is a video. @@ -7674,8 +8259,17 @@ type InputPaidMediaVideo struct { } ``` + +### func \(\*InputPaidMediaVideo\) [MarshalJSON]() + +```go +func (v *InputPaidMediaVideo) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputPaidMediaVideo with the discriminator field "type" forced to "video". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputPollMedia]() +## type [InputPollMedia]() InputPollMedia is a union type. The following concrete variants implement it: @@ -7697,7 +8291,7 @@ type InputPollMedia interface { ``` -## type [InputPollOption]() +## type [InputPollOption]() This object contains information about one answer option in a poll to be sent. @@ -7715,7 +8309,7 @@ type InputPollOption struct { ``` -## type [InputPollOptionMedia]() +## type [InputPollOptionMedia]() InputPollOptionMedia is a union type. The following concrete variants implement it: @@ -7736,7 +8330,7 @@ type InputPollOptionMedia interface { ``` -## type [InputProfilePhoto]() +## type [InputProfilePhoto]() InputProfilePhoto is a union type. The following concrete variants implement it: @@ -7752,7 +8346,7 @@ type InputProfilePhoto interface { ``` -## type [InputProfilePhotoAnimated]() +## type [InputProfilePhotoAnimated]() An animated profile photo in the MPEG4 format. @@ -7767,8 +8361,17 @@ type InputProfilePhotoAnimated struct { } ``` + +### func \(\*InputProfilePhotoAnimated\) [MarshalJSON]() + +```go +func (v *InputProfilePhotoAnimated) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputProfilePhotoAnimated with the discriminator field "type" forced to "animated". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputProfilePhotoStatic]() +## type [InputProfilePhotoStatic]() A static profile photo in the .JPG format. @@ -7781,8 +8384,17 @@ type InputProfilePhotoStatic struct { } ``` + +### func \(\*InputProfilePhotoStatic\) [MarshalJSON]() + +```go +func (v *InputProfilePhotoStatic) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputProfilePhotoStatic with the discriminator field "type" forced to "static". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputSticker]() +## type [InputSticker]() This object describes a sticker to be added to a sticker set. @@ -7821,7 +8433,7 @@ const ( ``` -## type [InputStoryContent]() +## type [InputStoryContent]() InputStoryContent is a union type. The following concrete variants implement it: @@ -7837,7 +8449,7 @@ type InputStoryContent interface { ``` -## type [InputStoryContentPhoto]() +## type [InputStoryContentPhoto]() Describes a photo to post as a story. @@ -7850,8 +8462,17 @@ type InputStoryContentPhoto struct { } ``` + +### func \(\*InputStoryContentPhoto\) [MarshalJSON]() + +```go +func (v *InputStoryContentPhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputStoryContentPhoto with the discriminator field "type" forced to "photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputStoryContentVideo]() +## type [InputStoryContentVideo]() Describes a video to post as a story. @@ -7870,8 +8491,17 @@ type InputStoryContentVideo struct { } ``` + +### func \(\*InputStoryContentVideo\) [MarshalJSON]() + +```go +func (v *InputStoryContentVideo) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes InputStoryContentVideo with the discriminator field "type" forced to "video". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [InputTextMessageContent]() +## type [InputTextMessageContent]() Represents the content of a text message to be sent as the result of an inline query. @@ -7889,7 +8519,7 @@ type InputTextMessageContent struct { ``` -## type [InputVenueMessageContent]() +## type [InputVenueMessageContent]() Represents the content of a venue message to be sent as the result of an inline query. @@ -7915,7 +8545,7 @@ type InputVenueMessageContent struct { ``` -## type [Invoice]() +## type [Invoice]() This object contains basic information about an invoice. @@ -7935,7 +8565,7 @@ type Invoice struct { ``` -## type [KeyboardButton]() +## type [KeyboardButton]() This object represents one button of the reply keyboard. At most one of the fields other than text, icon\_custom\_emoji\_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text. @@ -7965,7 +8595,7 @@ type KeyboardButton struct { ``` -## type [KeyboardButtonPollType]() +## type [KeyboardButtonPollType]() This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. @@ -7977,7 +8607,7 @@ type KeyboardButtonPollType struct { ``` -## type [KeyboardButtonRequestChat]() +## type [KeyboardButtonRequestChat]() This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate. More about requesting chats ». @@ -8009,7 +8639,7 @@ type KeyboardButtonRequestChat struct { ``` -## type [KeyboardButtonRequestManagedBot]() +## type [KeyboardButtonRequestManagedBot]() This object defines the parameters for the creation of a managed bot. Information about the created bot will be shared with the bot using the update managed\_bot and a Message with the field managed\_bot\_created. @@ -8025,7 +8655,7 @@ type KeyboardButtonRequestManagedBot struct { ``` -## type [KeyboardButtonRequestUsers]() +## type [KeyboardButtonRequestUsers]() This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. More about requesting users » @@ -8068,7 +8698,7 @@ const ( ``` -## type [LabeledPrice]() +## type [LabeledPrice]() This object represents a portion of the price for goods or services. @@ -8096,7 +8726,7 @@ type LeaveChatParams struct { ``` -## type [LinkPreviewOptions]() +## type [LinkPreviewOptions]() Describes the options used for link preview generation. @@ -8116,7 +8746,7 @@ type LinkPreviewOptions struct { ``` -## type [LivePhoto]() +## type [LivePhoto]() This object represents a live photo. @@ -8142,7 +8772,7 @@ type LivePhoto struct { ``` -## type [Location]() +## type [Location]() This object represents a point on the map. @@ -8164,7 +8794,7 @@ type Location struct { ``` -## type [LocationAddress]() +## type [LocationAddress]() Describes the physical address of a location. @@ -8194,7 +8824,7 @@ type LogOutParams struct { ``` -## type [LoginUrl]() +## type [LoginUrl]() This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in: Telegram apps support these buttons as of version 5.7. Sample bot: @discussbot @@ -8212,7 +8842,7 @@ type LoginUrl struct { ``` -## type [ManagedBotCreated]() +## type [ManagedBotCreated]() This object contains information about the bot that was created to be managed by the current bot. @@ -8224,7 +8854,7 @@ type ManagedBotCreated struct { ``` -## type [ManagedBotUpdated]() +## type [ManagedBotUpdated]() This object contains information about the creation, token update, or owner update of a bot that is managed by the current bot. @@ -8238,7 +8868,7 @@ type ManagedBotUpdated struct { ``` -## type [MaskPosition]() +## type [MaskPosition]() This object describes the position on faces where a mask should be placed by default. @@ -8337,7 +8967,7 @@ func (c *MeCache) Reset() Reset clears the cache. Useful in tests or after the bot's identity is known to have changed \(very rare\). -## type [MenuButton]() +## type [MenuButton]() MenuButton is a union type. The following concrete variants implement it: @@ -8365,7 +8995,7 @@ GetChatMenuButton calls the getChatMenuButton Telegram Bot API method. Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success. -### func [UnmarshalMenuButton]() +### func [UnmarshalMenuButton]() ```go func UnmarshalMenuButton(data []byte) (MenuButton, error) @@ -8374,7 +9004,7 @@ func UnmarshalMenuButton(data []byte) (MenuButton, error) UnmarshalMenuButton decodes a MenuButton from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [MenuButtonCommands]() +## type [MenuButtonCommands]() Represents a menu button, which opens the bot's list of commands. @@ -8385,8 +9015,17 @@ type MenuButtonCommands struct { } ``` + +### func \(\*MenuButtonCommands\) [MarshalJSON]() + +```go +func (v *MenuButtonCommands) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MenuButtonCommands with the discriminator field "type" forced to "commands". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [MenuButtonDefault]() +## type [MenuButtonDefault]() Describes that no specific value for the menu button was set. @@ -8397,8 +9036,17 @@ type MenuButtonDefault struct { } ``` + +### func \(\*MenuButtonDefault\) [MarshalJSON]() + +```go +func (v *MenuButtonDefault) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MenuButtonDefault with the discriminator field "type" forced to "default". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [MenuButtonWebApp]() +## type [MenuButtonWebApp]() Represents a menu button, which launches a Web App. @@ -8413,6 +9061,15 @@ type MenuButtonWebApp struct { } ``` + +### func \(\*MenuButtonWebApp\) [MarshalJSON]() + +```go +func (v *MenuButtonWebApp) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MenuButtonWebApp with the discriminator field "type" forced to "web\_app". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [Message]() @@ -8923,7 +9580,7 @@ func (m *Message) UnmarshalJSON(data []byte) error UnmarshalJSON decodes Message by dispatching union\-typed fields \(ForwardOrigin, PinnedMessage\) through their concrete UnmarshalXxx helpers. -## type [MessageAutoDeleteTimerChanged]() +## type [MessageAutoDeleteTimerChanged]() This object represents a service message about a change in auto\-delete timer settings. @@ -9169,7 +9826,7 @@ func UnmarshalMessageOrigin(data []byte) (MessageOrigin, error) UnmarshalMessageOrigin decodes a MessageOrigin from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [MessageOriginChannel]() +## type [MessageOriginChannel]() The message was originally sent to a channel chat. @@ -9188,6 +9845,15 @@ type MessageOriginChannel struct { } ``` + +### func \(\*MessageOriginChannel\) [MarshalJSON]() + +```go +func (v *MessageOriginChannel) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MessageOriginChannel with the discriminator field "type" forced to "channel". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [MessageOriginChannelType]() @@ -9206,7 +9872,7 @@ const ( ``` -## type [MessageOriginChat]() +## type [MessageOriginChat]() The message was originally sent on behalf of a chat to a group chat. @@ -9223,6 +9889,15 @@ type MessageOriginChat struct { } ``` + +### func \(\*MessageOriginChat\) [MarshalJSON]() + +```go +func (v *MessageOriginChat) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MessageOriginChat with the discriminator field "type" forced to "chat". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [MessageOriginChatType]() @@ -9241,7 +9916,7 @@ const ( ``` -## type [MessageOriginHiddenUser]() +## type [MessageOriginHiddenUser]() The message was originally sent by an unknown user. @@ -9256,6 +9931,15 @@ type MessageOriginHiddenUser struct { } ``` + +### func \(\*MessageOriginHiddenUser\) [MarshalJSON]() + +```go +func (v *MessageOriginHiddenUser) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MessageOriginHiddenUser with the discriminator field "type" forced to "hidden\_user". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [MessageOriginHiddenUserType]() @@ -9289,6 +9973,15 @@ type MessageOriginUser struct { } ``` + +### func \(\*MessageOriginUser\) [MarshalJSON]() + +```go +func (v *MessageOriginUser) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes MessageOriginUser with the discriminator field "type" forced to "user". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [MessageOriginUserType]() @@ -9307,7 +10000,7 @@ const ( ``` -## type [MessageReactionCountUpdated]() +## type [MessageReactionCountUpdated]() This object represents reaction changes on a message with anonymous reactions. @@ -9325,7 +10018,7 @@ type MessageReactionCountUpdated struct { ``` -## type [MessageReactionUpdated]() +## type [MessageReactionUpdated]() This object represents a change of a reaction on a message performed by a user. @@ -9358,7 +10051,7 @@ func (mru *MessageReactionUpdated) GetSender() *Sender GetSender constructs a Sender for a MessageReactionUpdated. -### func \(\*MessageReactionUpdated\) [UnmarshalJSON]() +### func \(\*MessageReactionUpdated\) [UnmarshalJSON]() ```go func (m *MessageReactionUpdated) UnmarshalJSON(data []byte) error @@ -9367,7 +10060,7 @@ func (m *MessageReactionUpdated) UnmarshalJSON(data []byte) error UnmarshalJSON decodes MessageReactionUpdated by dispatching union\-typed fields \(OldReaction, NewReaction\) through their concrete UnmarshalXxx helpers. -## type [OrderInfo]() +## type [OrderInfo]() This object represents information about an order. @@ -9385,7 +10078,7 @@ type OrderInfo struct { ``` -## type [OwnedGift]() +## type [OwnedGift]() OwnedGift is a union type. The following concrete variants implement it: @@ -9401,7 +10094,7 @@ type OwnedGift interface { ``` -### func [UnmarshalOwnedGift]() +### func [UnmarshalOwnedGift]() ```go func UnmarshalOwnedGift(data []byte) (OwnedGift, error) @@ -9410,7 +10103,7 @@ func UnmarshalOwnedGift(data []byte) (OwnedGift, error) UnmarshalOwnedGift decodes a OwnedGift from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [OwnedGiftRegular]() +## type [OwnedGiftRegular]() Describes a regular gift owned by a user or a chat. @@ -9449,6 +10142,15 @@ type OwnedGiftRegular struct { } ``` + +### func \(\*OwnedGiftRegular\) [MarshalJSON]() + +```go +func (v *OwnedGiftRegular) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes OwnedGiftRegular with the discriminator field "type" forced to "regular". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [OwnedGiftRegularType]() @@ -9467,7 +10169,7 @@ const ( ``` -## type [OwnedGiftUnique]() +## type [OwnedGiftUnique]() Describes a unique gift received and owned by a user or a chat. @@ -9494,6 +10196,15 @@ type OwnedGiftUnique struct { } ``` + +### func \(\*OwnedGiftUnique\) [MarshalJSON]() + +```go +func (v *OwnedGiftUnique) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes OwnedGiftUnique with the discriminator field "type" forced to "unique". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [OwnedGiftUniqueType]() @@ -9512,7 +10223,7 @@ const ( ``` -## type [OwnedGifts]() +## type [OwnedGifts]() Contains the list of gifts received and owned by a user or a chat. @@ -9561,7 +10272,7 @@ GetUserGifts calls the getUserGifts Telegram Bot API method. Returns the gifts owned and hosted by a user. Returns OwnedGifts on success. -### func \(\*OwnedGifts\) [UnmarshalJSON]() +### func \(\*OwnedGifts\) [UnmarshalJSON]() ```go func (m *OwnedGifts) UnmarshalJSON(data []byte) error @@ -9570,7 +10281,7 @@ func (m *OwnedGifts) UnmarshalJSON(data []byte) error UnmarshalJSON decodes OwnedGifts by dispatching union\-typed fields \(Gifts\) through their concrete UnmarshalXxx helpers. -## type [PaidMedia]() +## type [PaidMedia]() PaidMedia is a union type. The following concrete variants implement it: @@ -9588,7 +10299,7 @@ type PaidMedia interface { ``` -### func [UnmarshalPaidMedia]() +### func [UnmarshalPaidMedia]() ```go func UnmarshalPaidMedia(data []byte) (PaidMedia, error) @@ -9597,7 +10308,7 @@ func UnmarshalPaidMedia(data []byte) (PaidMedia, error) UnmarshalPaidMedia decodes a PaidMedia from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [PaidMediaInfo]() +## type [PaidMediaInfo]() Describes the paid media added to a message. @@ -9611,7 +10322,7 @@ type PaidMediaInfo struct { ``` -### func \(\*PaidMediaInfo\) [UnmarshalJSON]() +### func \(\*PaidMediaInfo\) [UnmarshalJSON]() ```go func (m *PaidMediaInfo) UnmarshalJSON(data []byte) error @@ -9620,7 +10331,7 @@ func (m *PaidMediaInfo) UnmarshalJSON(data []byte) error UnmarshalJSON decodes PaidMediaInfo by dispatching union\-typed fields \(PaidMedia\) through their concrete UnmarshalXxx helpers. -## type [PaidMediaLivePhoto]() +## type [PaidMediaLivePhoto]() The paid media is a live photo. @@ -9633,6 +10344,15 @@ type PaidMediaLivePhoto struct { } ``` + +### func \(\*PaidMediaLivePhoto\) [MarshalJSON]() + +```go +func (v *PaidMediaLivePhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PaidMediaLivePhoto with the discriminator field "type" forced to "live\_photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PaidMediaLivePhotoType]() @@ -9651,7 +10371,7 @@ const ( ``` -## type [PaidMediaPhoto]() +## type [PaidMediaPhoto]() The paid media is a photo. @@ -9664,6 +10384,15 @@ type PaidMediaPhoto struct { } ``` + +### func \(\*PaidMediaPhoto\) [MarshalJSON]() + +```go +func (v *PaidMediaPhoto) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PaidMediaPhoto with the discriminator field "type" forced to "photo". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PaidMediaPhotoType]() @@ -9682,7 +10411,7 @@ const ( ``` -## type [PaidMediaPreview]() +## type [PaidMediaPreview]() The paid media isn't available before the payment. @@ -9699,6 +10428,15 @@ type PaidMediaPreview struct { } ``` + +### func \(\*PaidMediaPreview\) [MarshalJSON]() + +```go +func (v *PaidMediaPreview) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PaidMediaPreview with the discriminator field "type" forced to "preview". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PaidMediaPreviewType]() @@ -9717,7 +10455,7 @@ const ( ``` -## type [PaidMediaPurchased]() +## type [PaidMediaPurchased]() This object contains information about a paid media purchase. @@ -9731,7 +10469,7 @@ type PaidMediaPurchased struct { ``` -## type [PaidMediaVideo]() +## type [PaidMediaVideo]() The paid media is a video. @@ -9744,6 +10482,15 @@ type PaidMediaVideo struct { } ``` + +### func \(\*PaidMediaVideo\) [MarshalJSON]() + +```go +func (v *PaidMediaVideo) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PaidMediaVideo with the discriminator field "type" forced to "video". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PaidMediaVideoType]() @@ -9762,7 +10509,7 @@ const ( ``` -## type [PaidMessagePriceChanged]() +## type [PaidMessagePriceChanged]() Describes a service message about a change in the price of paid messages within a chat. @@ -9793,7 +10540,7 @@ const ( ``` -## type [PassportData]() +## type [PassportData]() Describes Telegram Passport data shared with the bot by the user. @@ -9807,7 +10554,7 @@ type PassportData struct { ``` -## type [PassportElementError]() +## type [PassportElementError]() PassportElementError is a union type. The following concrete variants implement it: @@ -9830,7 +10577,7 @@ type PassportElementError interface { ``` -## type [PassportElementErrorDataField]() +## type [PassportElementErrorDataField]() Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. @@ -9849,6 +10596,15 @@ type PassportElementErrorDataField struct { } ``` + +### func \(\*PassportElementErrorDataField\) [MarshalJSON]() + +```go +func (v *PassportElementErrorDataField) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorDataField with the discriminator field "source" forced to "data". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PassportElementErrorDataFieldType]() @@ -9872,7 +10628,7 @@ const ( ``` -## type [PassportElementErrorFile]() +## type [PassportElementErrorFile]() Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. @@ -9889,6 +10645,15 @@ type PassportElementErrorFile struct { } ``` + +### func \(\*PassportElementErrorFile\) [MarshalJSON]() + +```go +func (v *PassportElementErrorFile) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorFile with the discriminator field "source" forced to "file". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PassportElementErrorFileType]() @@ -9911,7 +10676,7 @@ const ( ``` -## type [PassportElementErrorFiles]() +## type [PassportElementErrorFiles]() Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. @@ -9928,8 +10693,17 @@ type PassportElementErrorFiles struct { } ``` + +### func \(\*PassportElementErrorFiles\) [MarshalJSON]() + +```go +func (v *PassportElementErrorFiles) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorFiles with the discriminator field "source" forced to "files". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [PassportElementErrorFrontSide]() +## type [PassportElementErrorFrontSide]() Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. @@ -9946,8 +10720,17 @@ type PassportElementErrorFrontSide struct { } ``` + +### func \(\*PassportElementErrorFrontSide\) [MarshalJSON]() + +```go +func (v *PassportElementErrorFrontSide) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorFrontSide with the discriminator field "source" forced to "front\_side". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [PassportElementErrorReverseSide]() +## type [PassportElementErrorReverseSide]() Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. @@ -9964,6 +10747,15 @@ type PassportElementErrorReverseSide struct { } ``` + +### func \(\*PassportElementErrorReverseSide\) [MarshalJSON]() + +```go +func (v *PassportElementErrorReverseSide) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorReverseSide with the discriminator field "source" forced to "reverse\_side". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PassportElementErrorReverseSideType]() @@ -9983,7 +10775,7 @@ const ( ``` -## type [PassportElementErrorSelfie]() +## type [PassportElementErrorSelfie]() Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. @@ -10000,6 +10792,15 @@ type PassportElementErrorSelfie struct { } ``` + +### func \(\*PassportElementErrorSelfie\) [MarshalJSON]() + +```go +func (v *PassportElementErrorSelfie) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorSelfie with the discriminator field "source" forced to "selfie". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PassportElementErrorSelfieType]() @@ -10021,7 +10822,7 @@ const ( ``` -## type [PassportElementErrorTranslationFile]() +## type [PassportElementErrorTranslationFile]() Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. @@ -10038,6 +10839,15 @@ type PassportElementErrorTranslationFile struct { } ``` + +### func \(\*PassportElementErrorTranslationFile\) [MarshalJSON]() + +```go +func (v *PassportElementErrorTranslationFile) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorTranslationFile with the discriminator field "source" forced to "translation\_file". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [PassportElementErrorTranslationFileType]() @@ -10064,7 +10874,7 @@ const ( ``` -## type [PassportElementErrorTranslationFiles]() +## type [PassportElementErrorTranslationFiles]() Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. @@ -10081,8 +10891,17 @@ type PassportElementErrorTranslationFiles struct { } ``` + +### func \(\*PassportElementErrorTranslationFiles\) [MarshalJSON]() + +```go +func (v *PassportElementErrorTranslationFiles) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorTranslationFiles with the discriminator field "source" forced to "translation\_files". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [PassportElementErrorUnspecified]() +## type [PassportElementErrorUnspecified]() Represents an issue in an unspecified place. The error is considered resolved when new data is added. @@ -10099,8 +10918,17 @@ type PassportElementErrorUnspecified struct { } ``` + +### func \(\*PassportElementErrorUnspecified\) [MarshalJSON]() + +```go +func (v *PassportElementErrorUnspecified) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes PassportElementErrorUnspecified with the discriminator field "source" forced to "unspecified". The hardcoded value frees callers from setting Source by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [PassportFile]() +## type [PassportFile]() This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. @@ -10118,7 +10946,7 @@ type PassportFile struct { ``` -## type [PhotoSize]() +## type [PhotoSize]() This object represents one size of a photo or a file / sticker thumbnail. @@ -10158,7 +10986,7 @@ type PinChatMessageParams struct { ``` -## type [Poll]() +## type [Poll]() This object contains information about a poll. @@ -10221,7 +11049,7 @@ StopPoll calls the stopPoll Telegram Bot API method. Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned. -## type [PollAnswer]() +## type [PollAnswer]() This object represents an answer of a user in a non\-anonymous poll. @@ -10250,7 +11078,7 @@ func (pa *PollAnswer) GetSender() *Sender GetSender constructs a Sender for a PollAnswer. -## type [PollMedia]() +## type [PollMedia]() At most one of the optional fields can be present in any given object. @@ -10278,7 +11106,7 @@ type PollMedia struct { ``` -## type [PollOption]() +## type [PollOption]() This object contains information about one answer option in a poll. @@ -10304,7 +11132,7 @@ type PollOption struct { ``` -## type [PollOptionAdded]() +## type [PollOptionAdded]() Describes a service message about an option added to a poll. @@ -10322,7 +11150,7 @@ type PollOptionAdded struct { ``` -### func \(\*PollOptionAdded\) [UnmarshalJSON]() +### func \(\*PollOptionAdded\) [UnmarshalJSON]() ```go func (m *PollOptionAdded) UnmarshalJSON(data []byte) error @@ -10331,7 +11159,7 @@ func (m *PollOptionAdded) UnmarshalJSON(data []byte) error UnmarshalJSON decodes PollOptionAdded by dispatching union\-typed fields \(PollMessage\) through their concrete UnmarshalXxx helpers. -## type [PollOptionDeleted]() +## type [PollOptionDeleted]() Describes a service message about an option deleted from a poll. @@ -10349,7 +11177,7 @@ type PollOptionDeleted struct { ``` -### func \(\*PollOptionDeleted\) [UnmarshalJSON]() +### func \(\*PollOptionDeleted\) [UnmarshalJSON]() ```go func (m *PollOptionDeleted) UnmarshalJSON(data []byte) error @@ -10406,7 +11234,7 @@ type PostStoryParams struct { ``` -## type [PreCheckoutQuery]() +## type [PreCheckoutQuery]() This object contains information about an incoming pre\-checkout query. @@ -10430,7 +11258,7 @@ type PreCheckoutQuery struct { ``` -## type [PreparedInlineMessage]() +## type [PreparedInlineMessage]() Describes an inline message to be sent by a user of a Mini App. @@ -10455,7 +11283,7 @@ SavePreparedInlineMessage calls the savePreparedInlineMessage Telegram Bot API m Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object. -## type [PreparedKeyboardButton]() +## type [PreparedKeyboardButton]() Describes a keyboard button to be used by a user of a Mini App. @@ -10528,7 +11356,7 @@ type PromoteChatMemberParams struct { ``` -## type [ProximityAlertTriggered]() +## type [ProximityAlertTriggered]() This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. @@ -10544,7 +11372,7 @@ type ProximityAlertTriggered struct { ``` -## type [ReactionCount]() +## type [ReactionCount]() Represents a reaction added to a message along with the number of times it was added. @@ -10558,7 +11386,7 @@ type ReactionCount struct { ``` -### func \(\*ReactionCount\) [UnmarshalJSON]() +### func \(\*ReactionCount\) [UnmarshalJSON]() ```go func (m *ReactionCount) UnmarshalJSON(data []byte) error @@ -10567,7 +11395,7 @@ func (m *ReactionCount) UnmarshalJSON(data []byte) error UnmarshalJSON decodes ReactionCount by dispatching union\-typed fields \(Type\) through their concrete UnmarshalXxx helpers. -## type [ReactionType]() +## type [ReactionType]() ReactionType is a union type. The following concrete variants implement it: @@ -10584,7 +11412,7 @@ type ReactionType interface { ``` -### func [UnmarshalReactionType]() +### func [UnmarshalReactionType]() ```go func UnmarshalReactionType(data []byte) (ReactionType, error) @@ -10593,7 +11421,7 @@ func UnmarshalReactionType(data []byte) (ReactionType, error) UnmarshalReactionType decodes a ReactionType from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [ReactionTypeCustomEmoji]() +## type [ReactionTypeCustomEmoji]() The reaction is based on a custom emoji. @@ -10606,6 +11434,15 @@ type ReactionTypeCustomEmoji struct { } ``` + +### func \(\*ReactionTypeCustomEmoji\) [MarshalJSON]() + +```go +func (v *ReactionTypeCustomEmoji) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ReactionTypeCustomEmoji with the discriminator field "type" forced to "custom\_emoji". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ReactionTypeCustomEmojiType]() @@ -10624,7 +11461,7 @@ const ( ``` -## type [ReactionTypeEmoji]() +## type [ReactionTypeEmoji]() The reaction is based on an emoji. @@ -10637,6 +11474,15 @@ type ReactionTypeEmoji struct { } ``` + +### func \(\*ReactionTypeEmoji\) [MarshalJSON]() + +```go +func (v *ReactionTypeEmoji) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ReactionTypeEmoji with the discriminator field "type" forced to "emoji". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ReactionTypeEmojiType]() @@ -10655,7 +11501,7 @@ const ( ``` -## type [ReactionTypePaid]() +## type [ReactionTypePaid]() The reaction is paid. @@ -10666,6 +11512,15 @@ type ReactionTypePaid struct { } ``` + +### func \(\*ReactionTypePaid\) [MarshalJSON]() + +```go +func (v *ReactionTypePaid) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes ReactionTypePaid with the discriminator field "type" forced to "paid". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [ReactionTypePaidType]() @@ -10718,7 +11573,7 @@ type RefundStarPaymentParams struct { ``` -## type [RefundedPayment]() +## type [RefundedPayment]() This object contains basic information about a refunded payment. @@ -10875,7 +11730,7 @@ type ReplaceStickerInSetParams struct { ``` -## type [ReplyKeyboardMarkup]() +## type [ReplyKeyboardMarkup]() This object represents a custom keyboard with reply options \(see Introduction to bots for details and examples\). Not supported in channels and for messages sent on behalf of a business account. @@ -10897,7 +11752,7 @@ type ReplyKeyboardMarkup struct { ``` -## type [ReplyKeyboardRemove]() +## type [ReplyKeyboardRemove]() Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter\-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one\-time keyboards that are hidden immediately after the user presses a button \(see ReplyKeyboardMarkup\). Not supported in channels and for messages sent on behalf of a business account. @@ -10999,7 +11854,7 @@ type RestrictChatMemberParams struct { ``` -## type [RevenueWithdrawalState]() +## type [RevenueWithdrawalState]() RevenueWithdrawalState is a union type. The following concrete variants implement it: @@ -11016,7 +11871,7 @@ type RevenueWithdrawalState interface { ``` -### func [UnmarshalRevenueWithdrawalState]() +### func [UnmarshalRevenueWithdrawalState]() ```go func UnmarshalRevenueWithdrawalState(data []byte) (RevenueWithdrawalState, error) @@ -11025,7 +11880,7 @@ func UnmarshalRevenueWithdrawalState(data []byte) (RevenueWithdrawalState, error UnmarshalRevenueWithdrawalState decodes a RevenueWithdrawalState from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [RevenueWithdrawalStateFailed]() +## type [RevenueWithdrawalStateFailed]() The withdrawal failed and the transaction was refunded. @@ -11036,6 +11891,15 @@ type RevenueWithdrawalStateFailed struct { } ``` + +### func \(\*RevenueWithdrawalStateFailed\) [MarshalJSON]() + +```go +func (v *RevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes RevenueWithdrawalStateFailed with the discriminator field "type" forced to "failed". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [RevenueWithdrawalStateFailedType]() @@ -11054,7 +11918,7 @@ const ( ``` -## type [RevenueWithdrawalStatePending]() +## type [RevenueWithdrawalStatePending]() The withdrawal is in progress. @@ -11065,6 +11929,15 @@ type RevenueWithdrawalStatePending struct { } ``` + +### func \(\*RevenueWithdrawalStatePending\) [MarshalJSON]() + +```go +func (v *RevenueWithdrawalStatePending) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes RevenueWithdrawalStatePending with the discriminator field "type" forced to "pending". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [RevenueWithdrawalStatePendingType]() @@ -11083,7 +11956,7 @@ const ( ``` -## type [RevenueWithdrawalStateSucceeded]() +## type [RevenueWithdrawalStateSucceeded]() The withdrawal succeeded. @@ -11098,6 +11971,15 @@ type RevenueWithdrawalStateSucceeded struct { } ``` + +### func \(\*RevenueWithdrawalStateSucceeded\) [MarshalJSON]() + +```go +func (v *RevenueWithdrawalStateSucceeded) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes RevenueWithdrawalStateSucceeded with the discriminator field "type" forced to "succeeded". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [RevenueWithdrawalStateSucceededType]() @@ -12527,7 +13409,7 @@ func (s *Sender) IsAnonymousChannel() bool IsAnonymousChannel reports whether the sender is an anonymous channel post \(Chat differs from the message's own chat\). -## type [SentGuestMessage]() +## type [SentGuestMessage]() Describes an inline message sent by a guest bot. @@ -12550,7 +13432,7 @@ AnswerGuestQuery calls the answerGuestQuery Telegram Bot API method. Use this method to reply to a received guest message. On success, a SentGuestMessage object is returned. -## type [SentWebAppMessage]() +## type [SentWebAppMessage]() Describes an inline message sent by a Web App on behalf of a user. @@ -13210,7 +14092,7 @@ func (p *SetWebhookParams) MultipartFiles() []client.MultipartFile MultipartFiles returns the file parts. -## type [SharedUser]() +## type [SharedUser]() This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button. @@ -13230,7 +14112,7 @@ type SharedUser struct { ``` -## type [ShippingAddress]() +## type [ShippingAddress]() This object represents a shipping address. @@ -13252,7 +14134,7 @@ type ShippingAddress struct { ``` -## type [ShippingOption]() +## type [ShippingOption]() This object represents one shipping option. @@ -13268,7 +14150,7 @@ type ShippingOption struct { ``` -## type [ShippingQuery]() +## type [ShippingQuery]() This object contains information about an incoming shipping query. @@ -13286,7 +14168,7 @@ type ShippingQuery struct { ``` -## type [StarAmount]() +## type [StarAmount]() Describes an amount of Telegram Stars. @@ -13322,7 +14204,7 @@ GetMyStarBalance calls the getMyStarBalance Telegram Bot API method. A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object. -## type [StarTransaction]() +## type [StarTransaction]() Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars \(e.g., Apple, Google\) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control. @@ -13344,7 +14226,7 @@ type StarTransaction struct { ``` -### func \(\*StarTransaction\) [UnmarshalJSON]() +### func \(\*StarTransaction\) [UnmarshalJSON]() ```go func (m *StarTransaction) UnmarshalJSON(data []byte) error @@ -13353,7 +14235,7 @@ func (m *StarTransaction) UnmarshalJSON(data []byte) error UnmarshalJSON decodes StarTransaction by dispatching union\-typed fields \(Source, Receiver\) through their concrete UnmarshalXxx helpers. -## type [StarTransactions]() +## type [StarTransactions]() Contains a list of Telegram Star transactions. @@ -13376,7 +14258,7 @@ GetStarTransactions calls the getStarTransactions Telegram Bot API method. Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object. -## type [Sticker]() +## type [Sticker]() This object represents a sticker. @@ -13438,7 +14320,7 @@ GetForumTopicIconStickers calls the getForumTopicIconStickers Telegram Bot API m Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects. -## type [StickerSet]() +## type [StickerSet]() This object represents a sticker set. @@ -13530,7 +14412,7 @@ type StopPollParams struct { ``` -## type [Story]() +## type [Story]() This object represents a story. @@ -13577,7 +14459,7 @@ RepostStory calls the repostStory Telegram Bot API method. Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted \(or reposted\) by the bot. Requires the can\_manage\_stories business bot right for both business accounts. Returns Story on success. -## type [StoryArea]() +## type [StoryArea]() Describes a clickable area on a story media. @@ -13591,7 +14473,7 @@ type StoryArea struct { ``` -### func \(\*StoryArea\) [UnmarshalJSON]() +### func \(\*StoryArea\) [UnmarshalJSON]() ```go func (m *StoryArea) UnmarshalJSON(data []byte) error @@ -13600,7 +14482,7 @@ func (m *StoryArea) UnmarshalJSON(data []byte) error UnmarshalJSON decodes StoryArea by dispatching union\-typed fields \(Type\) through their concrete UnmarshalXxx helpers. -## type [StoryAreaPosition]() +## type [StoryAreaPosition]() Describes the position of a clickable area within a story. @@ -13622,7 +14504,7 @@ type StoryAreaPosition struct { ``` -## type [StoryAreaType]() +## type [StoryAreaType]() StoryAreaType is a union type. The following concrete variants implement it: @@ -13641,7 +14523,7 @@ type StoryAreaType interface { ``` -### func [UnmarshalStoryAreaType]() +### func [UnmarshalStoryAreaType]() ```go func UnmarshalStoryAreaType(data []byte) (StoryAreaType, error) @@ -13650,7 +14532,7 @@ func UnmarshalStoryAreaType(data []byte) (StoryAreaType, error) UnmarshalStoryAreaType decodes a StoryAreaType from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [StoryAreaTypeLink]() +## type [StoryAreaTypeLink]() Describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas. @@ -13663,6 +14545,15 @@ type StoryAreaTypeLink struct { } ``` + +### func \(\*StoryAreaTypeLink\) [MarshalJSON]() + +```go +func (v *StoryAreaTypeLink) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes StoryAreaTypeLink with the discriminator field "type" forced to "link". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [StoryAreaTypeLinkType]() @@ -13681,7 +14572,7 @@ const ( ``` -## type [StoryAreaTypeLocation]() +## type [StoryAreaTypeLocation]() Describes a story area pointing to a location. Currently, a story can have up to 10 location areas. @@ -13698,6 +14589,15 @@ type StoryAreaTypeLocation struct { } ``` + +### func \(\*StoryAreaTypeLocation\) [MarshalJSON]() + +```go +func (v *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes StoryAreaTypeLocation with the discriminator field "type" forced to "location". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [StoryAreaTypeLocationType]() @@ -13716,7 +14616,7 @@ const ( ``` -## type [StoryAreaTypeSuggestedReaction]() +## type [StoryAreaTypeSuggestedReaction]() Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas. @@ -13733,8 +14633,17 @@ type StoryAreaTypeSuggestedReaction struct { } ``` + +### func \(\*StoryAreaTypeSuggestedReaction\) [MarshalJSON]() + +```go +func (v *StoryAreaTypeSuggestedReaction) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes StoryAreaTypeSuggestedReaction with the discriminator field "type" forced to "suggested\_reaction". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -### func \(\*StoryAreaTypeSuggestedReaction\) [UnmarshalJSON]() +### func \(\*StoryAreaTypeSuggestedReaction\) [UnmarshalJSON]() ```go func (m *StoryAreaTypeSuggestedReaction) UnmarshalJSON(data []byte) error @@ -13760,7 +14669,7 @@ const ( ``` -## type [StoryAreaTypeUniqueGift]() +## type [StoryAreaTypeUniqueGift]() Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area. @@ -13773,6 +14682,15 @@ type StoryAreaTypeUniqueGift struct { } ``` + +### func \(\*StoryAreaTypeUniqueGift\) [MarshalJSON]() + +```go +func (v *StoryAreaTypeUniqueGift) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes StoryAreaTypeUniqueGift with the discriminator field "type" forced to "unique\_gift". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [StoryAreaTypeUniqueGiftType]() @@ -13791,7 +14709,7 @@ const ( ``` -## type [StoryAreaTypeWeather]() +## type [StoryAreaTypeWeather]() Describes a story area containing weather information. Currently, a story can have up to 3 weather areas. @@ -13808,6 +14726,15 @@ type StoryAreaTypeWeather struct { } ``` + +### func \(\*StoryAreaTypeWeather\) [MarshalJSON]() + +```go +func (v *StoryAreaTypeWeather) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes StoryAreaTypeWeather with the discriminator field "type" forced to "weather". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [StoryAreaTypeWeatherType]() @@ -13826,7 +14753,7 @@ const ( ``` -## type [SuccessfulPayment]() +## type [SuccessfulPayment]() This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control. @@ -13856,7 +14783,7 @@ type SuccessfulPayment struct { ``` -## type [SuggestedPostApprovalFailed]() +## type [SuggestedPostApprovalFailed]() Describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval. @@ -13870,7 +14797,7 @@ type SuggestedPostApprovalFailed struct { ``` -## type [SuggestedPostApproved]() +## type [SuggestedPostApproved]() Describes a service message about the approval of a suggested post. @@ -13886,7 +14813,7 @@ type SuggestedPostApproved struct { ``` -## type [SuggestedPostDeclined]() +## type [SuggestedPostDeclined]() Describes a service message about the rejection of a suggested post. @@ -13900,7 +14827,7 @@ type SuggestedPostDeclined struct { ``` -## type [SuggestedPostInfo]() +## type [SuggestedPostInfo]() Contains information about a suggested post. @@ -13935,7 +14862,7 @@ const ( ``` -## type [SuggestedPostPaid]() +## type [SuggestedPostPaid]() Describes a service message about a successful payment for a suggested post. @@ -13971,7 +14898,7 @@ const ( ``` -## type [SuggestedPostParameters]() +## type [SuggestedPostParameters]() Contains parameters of a post that is being suggested by the bot. @@ -13985,7 +14912,7 @@ type SuggestedPostParameters struct { ``` -## type [SuggestedPostPrice]() +## type [SuggestedPostPrice]() Describes the price of a suggested post. @@ -13999,7 +14926,7 @@ type SuggestedPostPrice struct { ``` -## type [SuggestedPostRefunded]() +## type [SuggestedPostRefunded]() Describes a service message about a payment refund for a suggested post. @@ -14031,7 +14958,7 @@ const ( ``` -## type [SwitchInlineQueryChosenChat]() +## type [SwitchInlineQueryChosenChat]() This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query. @@ -14069,7 +14996,7 @@ type TextQuote struct { ``` -## type [TransactionPartner]() +## type [TransactionPartner]() TransactionPartner is a union type. The following concrete variants implement it: @@ -14090,7 +15017,7 @@ type TransactionPartner interface { ``` -### func [UnmarshalTransactionPartner]() +### func [UnmarshalTransactionPartner]() ```go func UnmarshalTransactionPartner(data []byte) (TransactionPartner, error) @@ -14099,7 +15026,7 @@ func UnmarshalTransactionPartner(data []byte) (TransactionPartner, error) UnmarshalTransactionPartner decodes a TransactionPartner from JSON by inspecting the "type" field and dispatching to the correct concrete type. -## type [TransactionPartnerAffiliateProgram]() +## type [TransactionPartnerAffiliateProgram]() Describes the affiliate program that issued the affiliate commission received via this transaction. @@ -14114,6 +15041,15 @@ type TransactionPartnerAffiliateProgram struct { } ``` + +### func \(\*TransactionPartnerAffiliateProgram\) [MarshalJSON]() + +```go +func (v *TransactionPartnerAffiliateProgram) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerAffiliateProgram with the discriminator field "type" forced to "affiliate\_program". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [TransactionPartnerAffiliateProgramType]() @@ -14132,7 +15068,7 @@ const ( ``` -## type [TransactionPartnerChat]() +## type [TransactionPartnerChat]() Describes a transaction with a chat. @@ -14147,8 +15083,17 @@ type TransactionPartnerChat struct { } ``` + +### func \(\*TransactionPartnerChat\) [MarshalJSON]() + +```go +func (v *TransactionPartnerChat) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerChat with the discriminator field "type" forced to "chat". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -## type [TransactionPartnerFragment]() +## type [TransactionPartnerFragment]() Describes a withdrawal transaction with Fragment. @@ -14161,8 +15106,17 @@ type TransactionPartnerFragment struct { } ``` + +### func \(\*TransactionPartnerFragment\) [MarshalJSON]() + +```go +func (v *TransactionPartnerFragment) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerFragment with the discriminator field "type" forced to "fragment". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -### func \(\*TransactionPartnerFragment\) [UnmarshalJSON]() +### func \(\*TransactionPartnerFragment\) [UnmarshalJSON]() ```go func (m *TransactionPartnerFragment) UnmarshalJSON(data []byte) error @@ -14188,7 +15142,7 @@ const ( ``` -## type [TransactionPartnerOther]() +## type [TransactionPartnerOther]() Describes a transaction with an unknown source or recipient. @@ -14199,6 +15153,15 @@ type TransactionPartnerOther struct { } ``` + +### func \(\*TransactionPartnerOther\) [MarshalJSON]() + +```go +func (v *TransactionPartnerOther) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerOther with the discriminator field "type" forced to "other". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [TransactionPartnerOtherType]() @@ -14217,7 +15180,7 @@ const ( ``` -## type [TransactionPartnerTelegramAds]() +## type [TransactionPartnerTelegramAds]() Describes a withdrawal transaction to the Telegram Ads platform. @@ -14228,6 +15191,15 @@ type TransactionPartnerTelegramAds struct { } ``` + +### func \(\*TransactionPartnerTelegramAds\) [MarshalJSON]() + +```go +func (v *TransactionPartnerTelegramAds) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerTelegramAds with the discriminator field "type" forced to "telegram\_ads". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [TransactionPartnerTelegramAdsType]() @@ -14246,7 +15218,7 @@ const ( ``` -## type [TransactionPartnerTelegramApi]() +## type [TransactionPartnerTelegramApi]() Describes a transaction with payment for paid broadcasting. @@ -14259,6 +15231,15 @@ type TransactionPartnerTelegramApi struct { } ``` + +### func \(\*TransactionPartnerTelegramApi\) [MarshalJSON]() + +```go +func (v *TransactionPartnerTelegramApi) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerTelegramApi with the discriminator field "type" forced to "telegram\_api". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + ## type [TransactionPartnerTelegramApiType]() @@ -14277,7 +15258,7 @@ const ( ``` -## type [TransactionPartnerUser]() +## type [TransactionPartnerUser]() Describes a transaction with a user. @@ -14306,8 +15287,17 @@ type TransactionPartnerUser struct { } ``` + +### func \(\*TransactionPartnerUser\) [MarshalJSON]() + +```go +func (v *TransactionPartnerUser) MarshalJSON() ([]byte, error) +``` + +MarshalJSON encodes TransactionPartnerUser with the discriminator field "type" forced to "user". The hardcoded value frees callers from setting Type by hand — any user\-supplied value on the struct literal is overridden so a typo can't slip through to Telegram. + -### func \(\*TransactionPartnerUser\) [UnmarshalJSON]() +### func \(\*TransactionPartnerUser\) [UnmarshalJSON]() ```go func (m *TransactionPartnerUser) UnmarshalJSON(data []byte) error @@ -14421,7 +15411,7 @@ type UnhideGeneralForumTopicParams struct { ``` -## type [UniqueGift]() +## type [UniqueGift]() This object describes a unique gift that was upgraded from a regular gift. @@ -14455,7 +15445,7 @@ type UniqueGift struct { ``` -## type [UniqueGiftBackdrop]() +## type [UniqueGiftBackdrop]() This object describes the backdrop of a unique gift. @@ -14471,7 +15461,7 @@ type UniqueGiftBackdrop struct { ``` -## type [UniqueGiftBackdropColors]() +## type [UniqueGiftBackdropColors]() This object describes the colors of the backdrop of a unique gift. @@ -14489,7 +15479,7 @@ type UniqueGiftBackdropColors struct { ``` -## type [UniqueGiftColors]() +## type [UniqueGiftColors]() This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift. @@ -14511,7 +15501,7 @@ type UniqueGiftColors struct { ``` -## type [UniqueGiftInfo]() +## type [UniqueGiftInfo]() Describes a service message about a unique gift that was sent or received. @@ -14556,7 +15546,7 @@ const ( ``` -## type [UniqueGiftModel]() +## type [UniqueGiftModel]() This object describes the model of a unique gift. @@ -14594,7 +15584,7 @@ const ( ``` -## type [UniqueGiftSymbol]() +## type [UniqueGiftSymbol]() This object describes the symbol shown on the pattern of a unique gift. @@ -14904,7 +15894,7 @@ GetMe calls the getMe Telegram Bot API method. A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object. -## type [UserChatBoosts]() +## type [UserChatBoosts]() This object represents a list of boosts added to a chat by a user. @@ -14927,7 +15917,7 @@ GetUserChatBoosts calls the getUserChatBoosts Telegram Bot API method. Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object. -## type [UserProfileAudios]() +## type [UserProfileAudios]() This object represents the audios displayed on a user's profile. @@ -14952,7 +15942,7 @@ GetUserProfileAudios calls the getUserProfileAudios Telegram Bot API method. Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object. -## type [UserProfilePhotos]() +## type [UserProfilePhotos]() This object represent a user's profile pictures. @@ -14977,7 +15967,7 @@ GetUserProfilePhotos calls the getUserProfilePhotos Telegram Bot API method. Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. -## type [UserRating]() +## type [UserRating]() This object describes the rating of a user based on their Telegram Star spendings. @@ -14995,7 +15985,7 @@ type UserRating struct { ``` -## type [UsersShared]() +## type [UsersShared]() This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button. @@ -15009,7 +15999,7 @@ type UsersShared struct { ``` -## type [Venue]() +## type [Venue]() This object represents a venue. @@ -15065,7 +16055,7 @@ type VerifyUserParams struct { ``` -## type [Video]() +## type [Video]() This object represents a video file. @@ -15099,7 +16089,7 @@ type Video struct { ``` -## type [VideoChatEnded]() +## type [VideoChatEnded]() This object represents a service message about a video chat ended in the chat. @@ -15111,7 +16101,7 @@ type VideoChatEnded struct { ``` -## type [VideoChatParticipantsInvited]() +## type [VideoChatParticipantsInvited]() This object represents a service message about new members invited to a video chat. @@ -15123,7 +16113,7 @@ type VideoChatParticipantsInvited struct { ``` -## type [VideoChatScheduled]() +## type [VideoChatScheduled]() This object represents a service message about a video chat scheduled in the chat. @@ -15135,7 +16125,7 @@ type VideoChatScheduled struct { ``` -## type [VideoChatStarted]() +## type [VideoChatStarted]() This object represents a service message about a video chat started in the chat. Currently holds no information. @@ -15145,7 +16135,7 @@ type VideoChatStarted struct { ``` -## type [VideoNote]() +## type [VideoNote]() This object represents a video message \(available in Telegram apps as of v.4.0\). @@ -15167,7 +16157,7 @@ type VideoNote struct { ``` -## type [VideoQuality]() +## type [VideoQuality]() This object represents a video file of a specific quality. @@ -15189,7 +16179,7 @@ type VideoQuality struct { ``` -## type [Voice]() +## type [Voice]() This object represents a voice note. @@ -15209,7 +16199,7 @@ type Voice struct { ``` -## type [WebAppData]() +## type [WebAppData]() Describes data sent from a Web App to the bot. @@ -15223,7 +16213,7 @@ type WebAppData struct { ``` -## type [WebAppInfo]() +## type [WebAppInfo]() Describes a Web App. @@ -15274,7 +16264,7 @@ GetWebhookInfo calls the getWebhookInfo Telegram Bot API method. Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. -## type [WriteAccessAllowed]() +## type [WriteAccessAllowed]() This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess. diff --git a/examples/inline/main.go b/examples/inline/main.go index 1e8dd02..fd3d7e7 100644 --- a/examples/inline/main.go +++ b/examples/inline/main.go @@ -35,7 +35,6 @@ func main() { // Echo the query as article results. results := []api.InlineQueryResult{ &api.InlineQueryResultArticle{ - Type: "article", ID: "echo", Title: "Echo: " + q.Query, InputMessageContent: &api.InputTextMessageContent{ @@ -43,7 +42,6 @@ func main() { }, }, &api.InlineQueryResultArticle{ - Type: "article", ID: "upper", Title: "UPPER: " + strings.ToUpper(q.Query), InputMessageContent: &api.InputTextMessageContent{