Files
mautrix-telegram/pkg/gotd/tdapi/tl_chat_boost_features_gen.go
T
2025-06-27 20:03:37 -07:00

533 lines
16 KiB
Go
Generated

// Code generated by gotdgen, DO NOT EDIT.
package tdapi
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
_ = tdjson.Encoder{}
)
// ChatBoostFeatures represents TL type `chatBoostFeatures#3d24fc08`.
type ChatBoostFeatures struct {
// The list of features
Features []ChatBoostLevelFeatures
// The minimum boost level required to set custom emoji for profile background
MinProfileBackgroundCustomEmojiBoostLevel int32
// The minimum boost level required to set custom emoji for reply header and link preview
// background; for channel chats only
MinBackgroundCustomEmojiBoostLevel int32
// The minimum boost level required to set emoji status
MinEmojiStatusBoostLevel int32
// The minimum boost level required to set a chat theme background as chat background
MinChatThemeBackgroundBoostLevel int32
// The minimum boost level required to set custom chat background
MinCustomBackgroundBoostLevel int32
// The minimum boost level required to set custom emoji sticker set for the chat; for
// supergroup chats only
MinCustomEmojiStickerSetBoostLevel int32
// The minimum boost level allowing to enable automatic translation of messages for
// non-Premium users; for channel chats only
MinAutomaticTranslationBoostLevel int32
// The minimum boost level allowing to recognize speech in video note and voice note
// messages for non-Premium users; for supergroup chats only
MinSpeechRecognitionBoostLevel int32
// The minimum boost level allowing to disable sponsored messages in the chat; for
// channel chats only
MinSponsoredMessageDisableBoostLevel int32
}
// ChatBoostFeaturesTypeID is TL type id of ChatBoostFeatures.
const ChatBoostFeaturesTypeID = 0x3d24fc08
// Ensuring interfaces in compile-time for ChatBoostFeatures.
var (
_ bin.Encoder = &ChatBoostFeatures{}
_ bin.Decoder = &ChatBoostFeatures{}
_ bin.BareEncoder = &ChatBoostFeatures{}
_ bin.BareDecoder = &ChatBoostFeatures{}
)
func (c *ChatBoostFeatures) Zero() bool {
if c == nil {
return true
}
if !(c.Features == nil) {
return false
}
if !(c.MinProfileBackgroundCustomEmojiBoostLevel == 0) {
return false
}
if !(c.MinBackgroundCustomEmojiBoostLevel == 0) {
return false
}
if !(c.MinEmojiStatusBoostLevel == 0) {
return false
}
if !(c.MinChatThemeBackgroundBoostLevel == 0) {
return false
}
if !(c.MinCustomBackgroundBoostLevel == 0) {
return false
}
if !(c.MinCustomEmojiStickerSetBoostLevel == 0) {
return false
}
if !(c.MinAutomaticTranslationBoostLevel == 0) {
return false
}
if !(c.MinSpeechRecognitionBoostLevel == 0) {
return false
}
if !(c.MinSponsoredMessageDisableBoostLevel == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (c *ChatBoostFeatures) String() string {
if c == nil {
return "ChatBoostFeatures(nil)"
}
type Alias ChatBoostFeatures
return fmt.Sprintf("ChatBoostFeatures%+v", Alias(*c))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*ChatBoostFeatures) TypeID() uint32 {
return ChatBoostFeaturesTypeID
}
// TypeName returns name of type in TL schema.
func (*ChatBoostFeatures) TypeName() string {
return "chatBoostFeatures"
}
// TypeInfo returns info about TL type.
func (c *ChatBoostFeatures) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "chatBoostFeatures",
ID: ChatBoostFeaturesTypeID,
}
if c == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Features",
SchemaName: "features",
},
{
Name: "MinProfileBackgroundCustomEmojiBoostLevel",
SchemaName: "min_profile_background_custom_emoji_boost_level",
},
{
Name: "MinBackgroundCustomEmojiBoostLevel",
SchemaName: "min_background_custom_emoji_boost_level",
},
{
Name: "MinEmojiStatusBoostLevel",
SchemaName: "min_emoji_status_boost_level",
},
{
Name: "MinChatThemeBackgroundBoostLevel",
SchemaName: "min_chat_theme_background_boost_level",
},
{
Name: "MinCustomBackgroundBoostLevel",
SchemaName: "min_custom_background_boost_level",
},
{
Name: "MinCustomEmojiStickerSetBoostLevel",
SchemaName: "min_custom_emoji_sticker_set_boost_level",
},
{
Name: "MinAutomaticTranslationBoostLevel",
SchemaName: "min_automatic_translation_boost_level",
},
{
Name: "MinSpeechRecognitionBoostLevel",
SchemaName: "min_speech_recognition_boost_level",
},
{
Name: "MinSponsoredMessageDisableBoostLevel",
SchemaName: "min_sponsored_message_disable_boost_level",
},
}
return typ
}
// Encode implements bin.Encoder.
func (c *ChatBoostFeatures) Encode(b *bin.Buffer) error {
if c == nil {
return fmt.Errorf("can't encode chatBoostFeatures#3d24fc08 as nil")
}
b.PutID(ChatBoostFeaturesTypeID)
return c.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (c *ChatBoostFeatures) EncodeBare(b *bin.Buffer) error {
if c == nil {
return fmt.Errorf("can't encode chatBoostFeatures#3d24fc08 as nil")
}
b.PutInt(len(c.Features))
for idx, v := range c.Features {
if err := v.EncodeBare(b); err != nil {
return fmt.Errorf("unable to encode bare chatBoostFeatures#3d24fc08: field features element with index %d: %w", idx, err)
}
}
b.PutInt32(c.MinProfileBackgroundCustomEmojiBoostLevel)
b.PutInt32(c.MinBackgroundCustomEmojiBoostLevel)
b.PutInt32(c.MinEmojiStatusBoostLevel)
b.PutInt32(c.MinChatThemeBackgroundBoostLevel)
b.PutInt32(c.MinCustomBackgroundBoostLevel)
b.PutInt32(c.MinCustomEmojiStickerSetBoostLevel)
b.PutInt32(c.MinAutomaticTranslationBoostLevel)
b.PutInt32(c.MinSpeechRecognitionBoostLevel)
b.PutInt32(c.MinSponsoredMessageDisableBoostLevel)
return nil
}
// Decode implements bin.Decoder.
func (c *ChatBoostFeatures) Decode(b *bin.Buffer) error {
if c == nil {
return fmt.Errorf("can't decode chatBoostFeatures#3d24fc08 to nil")
}
if err := b.ConsumeID(ChatBoostFeaturesTypeID); err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: %w", err)
}
return c.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (c *ChatBoostFeatures) DecodeBare(b *bin.Buffer) error {
if c == nil {
return fmt.Errorf("can't decode chatBoostFeatures#3d24fc08 to nil")
}
{
headerLen, err := b.Int()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field features: %w", err)
}
if headerLen > 0 {
c.Features = make([]ChatBoostLevelFeatures, 0, headerLen%bin.PreallocateLimit)
}
for idx := 0; idx < headerLen; idx++ {
var value ChatBoostLevelFeatures
if err := value.DecodeBare(b); err != nil {
return fmt.Errorf("unable to decode bare chatBoostFeatures#3d24fc08: field features: %w", err)
}
c.Features = append(c.Features, value)
}
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_profile_background_custom_emoji_boost_level: %w", err)
}
c.MinProfileBackgroundCustomEmojiBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_background_custom_emoji_boost_level: %w", err)
}
c.MinBackgroundCustomEmojiBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_emoji_status_boost_level: %w", err)
}
c.MinEmojiStatusBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_chat_theme_background_boost_level: %w", err)
}
c.MinChatThemeBackgroundBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_custom_background_boost_level: %w", err)
}
c.MinCustomBackgroundBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_custom_emoji_sticker_set_boost_level: %w", err)
}
c.MinCustomEmojiStickerSetBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_automatic_translation_boost_level: %w", err)
}
c.MinAutomaticTranslationBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_speech_recognition_boost_level: %w", err)
}
c.MinSpeechRecognitionBoostLevel = value
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_sponsored_message_disable_boost_level: %w", err)
}
c.MinSponsoredMessageDisableBoostLevel = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (c *ChatBoostFeatures) EncodeTDLibJSON(b tdjson.Encoder) error {
if c == nil {
return fmt.Errorf("can't encode chatBoostFeatures#3d24fc08 as nil")
}
b.ObjStart()
b.PutID("chatBoostFeatures")
b.Comma()
b.FieldStart("features")
b.ArrStart()
for idx, v := range c.Features {
if err := v.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode chatBoostFeatures#3d24fc08: field features element with index %d: %w", idx, err)
}
b.Comma()
}
b.StripComma()
b.ArrEnd()
b.Comma()
b.FieldStart("min_profile_background_custom_emoji_boost_level")
b.PutInt32(c.MinProfileBackgroundCustomEmojiBoostLevel)
b.Comma()
b.FieldStart("min_background_custom_emoji_boost_level")
b.PutInt32(c.MinBackgroundCustomEmojiBoostLevel)
b.Comma()
b.FieldStart("min_emoji_status_boost_level")
b.PutInt32(c.MinEmojiStatusBoostLevel)
b.Comma()
b.FieldStart("min_chat_theme_background_boost_level")
b.PutInt32(c.MinChatThemeBackgroundBoostLevel)
b.Comma()
b.FieldStart("min_custom_background_boost_level")
b.PutInt32(c.MinCustomBackgroundBoostLevel)
b.Comma()
b.FieldStart("min_custom_emoji_sticker_set_boost_level")
b.PutInt32(c.MinCustomEmojiStickerSetBoostLevel)
b.Comma()
b.FieldStart("min_automatic_translation_boost_level")
b.PutInt32(c.MinAutomaticTranslationBoostLevel)
b.Comma()
b.FieldStart("min_speech_recognition_boost_level")
b.PutInt32(c.MinSpeechRecognitionBoostLevel)
b.Comma()
b.FieldStart("min_sponsored_message_disable_boost_level")
b.PutInt32(c.MinSponsoredMessageDisableBoostLevel)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (c *ChatBoostFeatures) DecodeTDLibJSON(b tdjson.Decoder) error {
if c == nil {
return fmt.Errorf("can't decode chatBoostFeatures#3d24fc08 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("chatBoostFeatures"); err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: %w", err)
}
case "features":
if err := b.Arr(func(b tdjson.Decoder) error {
var value ChatBoostLevelFeatures
if err := value.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field features: %w", err)
}
c.Features = append(c.Features, value)
return nil
}); err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field features: %w", err)
}
case "min_profile_background_custom_emoji_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_profile_background_custom_emoji_boost_level: %w", err)
}
c.MinProfileBackgroundCustomEmojiBoostLevel = value
case "min_background_custom_emoji_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_background_custom_emoji_boost_level: %w", err)
}
c.MinBackgroundCustomEmojiBoostLevel = value
case "min_emoji_status_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_emoji_status_boost_level: %w", err)
}
c.MinEmojiStatusBoostLevel = value
case "min_chat_theme_background_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_chat_theme_background_boost_level: %w", err)
}
c.MinChatThemeBackgroundBoostLevel = value
case "min_custom_background_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_custom_background_boost_level: %w", err)
}
c.MinCustomBackgroundBoostLevel = value
case "min_custom_emoji_sticker_set_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_custom_emoji_sticker_set_boost_level: %w", err)
}
c.MinCustomEmojiStickerSetBoostLevel = value
case "min_automatic_translation_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_automatic_translation_boost_level: %w", err)
}
c.MinAutomaticTranslationBoostLevel = value
case "min_speech_recognition_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_speech_recognition_boost_level: %w", err)
}
c.MinSpeechRecognitionBoostLevel = value
case "min_sponsored_message_disable_boost_level":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode chatBoostFeatures#3d24fc08: field min_sponsored_message_disable_boost_level: %w", err)
}
c.MinSponsoredMessageDisableBoostLevel = value
default:
return b.Skip()
}
return nil
})
}
// GetFeatures returns value of Features field.
func (c *ChatBoostFeatures) GetFeatures() (value []ChatBoostLevelFeatures) {
if c == nil {
return
}
return c.Features
}
// GetMinProfileBackgroundCustomEmojiBoostLevel returns value of MinProfileBackgroundCustomEmojiBoostLevel field.
func (c *ChatBoostFeatures) GetMinProfileBackgroundCustomEmojiBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinProfileBackgroundCustomEmojiBoostLevel
}
// GetMinBackgroundCustomEmojiBoostLevel returns value of MinBackgroundCustomEmojiBoostLevel field.
func (c *ChatBoostFeatures) GetMinBackgroundCustomEmojiBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinBackgroundCustomEmojiBoostLevel
}
// GetMinEmojiStatusBoostLevel returns value of MinEmojiStatusBoostLevel field.
func (c *ChatBoostFeatures) GetMinEmojiStatusBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinEmojiStatusBoostLevel
}
// GetMinChatThemeBackgroundBoostLevel returns value of MinChatThemeBackgroundBoostLevel field.
func (c *ChatBoostFeatures) GetMinChatThemeBackgroundBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinChatThemeBackgroundBoostLevel
}
// GetMinCustomBackgroundBoostLevel returns value of MinCustomBackgroundBoostLevel field.
func (c *ChatBoostFeatures) GetMinCustomBackgroundBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinCustomBackgroundBoostLevel
}
// GetMinCustomEmojiStickerSetBoostLevel returns value of MinCustomEmojiStickerSetBoostLevel field.
func (c *ChatBoostFeatures) GetMinCustomEmojiStickerSetBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinCustomEmojiStickerSetBoostLevel
}
// GetMinAutomaticTranslationBoostLevel returns value of MinAutomaticTranslationBoostLevel field.
func (c *ChatBoostFeatures) GetMinAutomaticTranslationBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinAutomaticTranslationBoostLevel
}
// GetMinSpeechRecognitionBoostLevel returns value of MinSpeechRecognitionBoostLevel field.
func (c *ChatBoostFeatures) GetMinSpeechRecognitionBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinSpeechRecognitionBoostLevel
}
// GetMinSponsoredMessageDisableBoostLevel returns value of MinSponsoredMessageDisableBoostLevel field.
func (c *ChatBoostFeatures) GetMinSponsoredMessageDisableBoostLevel() (value int32) {
if c == nil {
return
}
return c.MinSponsoredMessageDisableBoostLevel
}