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

2573 lines
78 KiB
Go

// 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{}
)
// SuggestedActionEnableArchiveAndMuteNewChats represents TL type `suggestedActionEnableArchiveAndMuteNewChats#7841ec4f`.
type SuggestedActionEnableArchiveAndMuteNewChats struct {
}
// SuggestedActionEnableArchiveAndMuteNewChatsTypeID is TL type id of SuggestedActionEnableArchiveAndMuteNewChats.
const SuggestedActionEnableArchiveAndMuteNewChatsTypeID = 0x7841ec4f
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionEnableArchiveAndMuteNewChats) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionEnableArchiveAndMuteNewChats.
var (
_ bin.Encoder = &SuggestedActionEnableArchiveAndMuteNewChats{}
_ bin.Decoder = &SuggestedActionEnableArchiveAndMuteNewChats{}
_ bin.BareEncoder = &SuggestedActionEnableArchiveAndMuteNewChats{}
_ bin.BareDecoder = &SuggestedActionEnableArchiveAndMuteNewChats{}
_ SuggestedActionClass = &SuggestedActionEnableArchiveAndMuteNewChats{}
)
func (s *SuggestedActionEnableArchiveAndMuteNewChats) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) String() string {
if s == nil {
return "SuggestedActionEnableArchiveAndMuteNewChats(nil)"
}
type Alias SuggestedActionEnableArchiveAndMuteNewChats
return fmt.Sprintf("SuggestedActionEnableArchiveAndMuteNewChats%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionEnableArchiveAndMuteNewChats) TypeID() uint32 {
return SuggestedActionEnableArchiveAndMuteNewChatsTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionEnableArchiveAndMuteNewChats) TypeName() string {
return "suggestedActionEnableArchiveAndMuteNewChats"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionEnableArchiveAndMuteNewChats",
ID: SuggestedActionEnableArchiveAndMuteNewChatsTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f as nil")
}
b.PutID(SuggestedActionEnableArchiveAndMuteNewChatsTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f to nil")
}
if err := b.ConsumeID(SuggestedActionEnableArchiveAndMuteNewChatsTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f as nil")
}
b.ObjStart()
b.PutID("suggestedActionEnableArchiveAndMuteNewChats")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionEnableArchiveAndMuteNewChats) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionEnableArchiveAndMuteNewChats"); err != nil {
return fmt.Errorf("unable to decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionCheckPassword represents TL type `suggestedActionCheckPassword#71e072b7`.
type SuggestedActionCheckPassword struct {
}
// SuggestedActionCheckPasswordTypeID is TL type id of SuggestedActionCheckPassword.
const SuggestedActionCheckPasswordTypeID = 0x71e072b7
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionCheckPassword) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionCheckPassword.
var (
_ bin.Encoder = &SuggestedActionCheckPassword{}
_ bin.Decoder = &SuggestedActionCheckPassword{}
_ bin.BareEncoder = &SuggestedActionCheckPassword{}
_ bin.BareDecoder = &SuggestedActionCheckPassword{}
_ SuggestedActionClass = &SuggestedActionCheckPassword{}
)
func (s *SuggestedActionCheckPassword) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionCheckPassword) String() string {
if s == nil {
return "SuggestedActionCheckPassword(nil)"
}
type Alias SuggestedActionCheckPassword
return fmt.Sprintf("SuggestedActionCheckPassword%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionCheckPassword) TypeID() uint32 {
return SuggestedActionCheckPasswordTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionCheckPassword) TypeName() string {
return "suggestedActionCheckPassword"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionCheckPassword) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionCheckPassword",
ID: SuggestedActionCheckPasswordTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionCheckPassword) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCheckPassword#71e072b7 as nil")
}
b.PutID(SuggestedActionCheckPasswordTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionCheckPassword) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCheckPassword#71e072b7 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionCheckPassword) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCheckPassword#71e072b7 to nil")
}
if err := b.ConsumeID(SuggestedActionCheckPasswordTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionCheckPassword#71e072b7: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionCheckPassword) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCheckPassword#71e072b7 to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionCheckPassword) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCheckPassword#71e072b7 as nil")
}
b.ObjStart()
b.PutID("suggestedActionCheckPassword")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionCheckPassword) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCheckPassword#71e072b7 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionCheckPassword"); err != nil {
return fmt.Errorf("unable to decode suggestedActionCheckPassword#71e072b7: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionCheckPhoneNumber represents TL type `suggestedActionCheckPhoneNumber#26ab77eb`.
type SuggestedActionCheckPhoneNumber struct {
}
// SuggestedActionCheckPhoneNumberTypeID is TL type id of SuggestedActionCheckPhoneNumber.
const SuggestedActionCheckPhoneNumberTypeID = 0x26ab77eb
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionCheckPhoneNumber) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionCheckPhoneNumber.
var (
_ bin.Encoder = &SuggestedActionCheckPhoneNumber{}
_ bin.Decoder = &SuggestedActionCheckPhoneNumber{}
_ bin.BareEncoder = &SuggestedActionCheckPhoneNumber{}
_ bin.BareDecoder = &SuggestedActionCheckPhoneNumber{}
_ SuggestedActionClass = &SuggestedActionCheckPhoneNumber{}
)
func (s *SuggestedActionCheckPhoneNumber) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionCheckPhoneNumber) String() string {
if s == nil {
return "SuggestedActionCheckPhoneNumber(nil)"
}
type Alias SuggestedActionCheckPhoneNumber
return fmt.Sprintf("SuggestedActionCheckPhoneNumber%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionCheckPhoneNumber) TypeID() uint32 {
return SuggestedActionCheckPhoneNumberTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionCheckPhoneNumber) TypeName() string {
return "suggestedActionCheckPhoneNumber"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionCheckPhoneNumber) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionCheckPhoneNumber",
ID: SuggestedActionCheckPhoneNumberTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionCheckPhoneNumber) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCheckPhoneNumber#26ab77eb as nil")
}
b.PutID(SuggestedActionCheckPhoneNumberTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionCheckPhoneNumber) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCheckPhoneNumber#26ab77eb as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionCheckPhoneNumber) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCheckPhoneNumber#26ab77eb to nil")
}
if err := b.ConsumeID(SuggestedActionCheckPhoneNumberTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionCheckPhoneNumber#26ab77eb: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionCheckPhoneNumber) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCheckPhoneNumber#26ab77eb to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionCheckPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCheckPhoneNumber#26ab77eb as nil")
}
b.ObjStart()
b.PutID("suggestedActionCheckPhoneNumber")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionCheckPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCheckPhoneNumber#26ab77eb to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionCheckPhoneNumber"); err != nil {
return fmt.Errorf("unable to decode suggestedActionCheckPhoneNumber#26ab77eb: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionViewChecksHint represents TL type `suggestedActionViewChecksHint#35203547`.
type SuggestedActionViewChecksHint struct {
}
// SuggestedActionViewChecksHintTypeID is TL type id of SuggestedActionViewChecksHint.
const SuggestedActionViewChecksHintTypeID = 0x35203547
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionViewChecksHint) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionViewChecksHint.
var (
_ bin.Encoder = &SuggestedActionViewChecksHint{}
_ bin.Decoder = &SuggestedActionViewChecksHint{}
_ bin.BareEncoder = &SuggestedActionViewChecksHint{}
_ bin.BareDecoder = &SuggestedActionViewChecksHint{}
_ SuggestedActionClass = &SuggestedActionViewChecksHint{}
)
func (s *SuggestedActionViewChecksHint) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionViewChecksHint) String() string {
if s == nil {
return "SuggestedActionViewChecksHint(nil)"
}
type Alias SuggestedActionViewChecksHint
return fmt.Sprintf("SuggestedActionViewChecksHint%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionViewChecksHint) TypeID() uint32 {
return SuggestedActionViewChecksHintTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionViewChecksHint) TypeName() string {
return "suggestedActionViewChecksHint"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionViewChecksHint) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionViewChecksHint",
ID: SuggestedActionViewChecksHintTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionViewChecksHint) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionViewChecksHint#35203547 as nil")
}
b.PutID(SuggestedActionViewChecksHintTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionViewChecksHint) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionViewChecksHint#35203547 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionViewChecksHint) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionViewChecksHint#35203547 to nil")
}
if err := b.ConsumeID(SuggestedActionViewChecksHintTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionViewChecksHint#35203547: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionViewChecksHint) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionViewChecksHint#35203547 to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionViewChecksHint) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionViewChecksHint#35203547 as nil")
}
b.ObjStart()
b.PutID("suggestedActionViewChecksHint")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionViewChecksHint) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionViewChecksHint#35203547 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionViewChecksHint"); err != nil {
return fmt.Errorf("unable to decode suggestedActionViewChecksHint#35203547: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionConvertToBroadcastGroup represents TL type `suggestedActionConvertToBroadcastGroup#c67a2e38`.
type SuggestedActionConvertToBroadcastGroup struct {
// Supergroup identifier
SupergroupID int64
}
// SuggestedActionConvertToBroadcastGroupTypeID is TL type id of SuggestedActionConvertToBroadcastGroup.
const SuggestedActionConvertToBroadcastGroupTypeID = 0xc67a2e38
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionConvertToBroadcastGroup) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionConvertToBroadcastGroup.
var (
_ bin.Encoder = &SuggestedActionConvertToBroadcastGroup{}
_ bin.Decoder = &SuggestedActionConvertToBroadcastGroup{}
_ bin.BareEncoder = &SuggestedActionConvertToBroadcastGroup{}
_ bin.BareDecoder = &SuggestedActionConvertToBroadcastGroup{}
_ SuggestedActionClass = &SuggestedActionConvertToBroadcastGroup{}
)
func (s *SuggestedActionConvertToBroadcastGroup) Zero() bool {
if s == nil {
return true
}
if !(s.SupergroupID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionConvertToBroadcastGroup) String() string {
if s == nil {
return "SuggestedActionConvertToBroadcastGroup(nil)"
}
type Alias SuggestedActionConvertToBroadcastGroup
return fmt.Sprintf("SuggestedActionConvertToBroadcastGroup%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionConvertToBroadcastGroup) TypeID() uint32 {
return SuggestedActionConvertToBroadcastGroupTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionConvertToBroadcastGroup) TypeName() string {
return "suggestedActionConvertToBroadcastGroup"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionConvertToBroadcastGroup) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionConvertToBroadcastGroup",
ID: SuggestedActionConvertToBroadcastGroupTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "SupergroupID",
SchemaName: "supergroup_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionConvertToBroadcastGroup) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionConvertToBroadcastGroup#c67a2e38 as nil")
}
b.PutID(SuggestedActionConvertToBroadcastGroupTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionConvertToBroadcastGroup) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionConvertToBroadcastGroup#c67a2e38 as nil")
}
b.PutInt53(s.SupergroupID)
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionConvertToBroadcastGroup) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionConvertToBroadcastGroup#c67a2e38 to nil")
}
if err := b.ConsumeID(SuggestedActionConvertToBroadcastGroupTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionConvertToBroadcastGroup) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionConvertToBroadcastGroup#c67a2e38 to nil")
}
{
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: field supergroup_id: %w", err)
}
s.SupergroupID = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionConvertToBroadcastGroup) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionConvertToBroadcastGroup#c67a2e38 as nil")
}
b.ObjStart()
b.PutID("suggestedActionConvertToBroadcastGroup")
b.Comma()
b.FieldStart("supergroup_id")
b.PutInt53(s.SupergroupID)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionConvertToBroadcastGroup) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionConvertToBroadcastGroup#c67a2e38 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionConvertToBroadcastGroup"); err != nil {
return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: %w", err)
}
case "supergroup_id":
value, err := b.Int53()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: field supergroup_id: %w", err)
}
s.SupergroupID = value
default:
return b.Skip()
}
return nil
})
}
// GetSupergroupID returns value of SupergroupID field.
func (s *SuggestedActionConvertToBroadcastGroup) GetSupergroupID() (value int64) {
if s == nil {
return
}
return s.SupergroupID
}
// SuggestedActionSetPassword represents TL type `suggestedActionSetPassword#6f147d98`.
type SuggestedActionSetPassword struct {
// The number of days to pass between consecutive authorizations if the user declines to
// set password; if 0, then the user is advised to set the password for security reasons
AuthorizationDelay int32
}
// SuggestedActionSetPasswordTypeID is TL type id of SuggestedActionSetPassword.
const SuggestedActionSetPasswordTypeID = 0x6f147d98
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionSetPassword) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionSetPassword.
var (
_ bin.Encoder = &SuggestedActionSetPassword{}
_ bin.Decoder = &SuggestedActionSetPassword{}
_ bin.BareEncoder = &SuggestedActionSetPassword{}
_ bin.BareDecoder = &SuggestedActionSetPassword{}
_ SuggestedActionClass = &SuggestedActionSetPassword{}
)
func (s *SuggestedActionSetPassword) Zero() bool {
if s == nil {
return true
}
if !(s.AuthorizationDelay == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionSetPassword) String() string {
if s == nil {
return "SuggestedActionSetPassword(nil)"
}
type Alias SuggestedActionSetPassword
return fmt.Sprintf("SuggestedActionSetPassword%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionSetPassword) TypeID() uint32 {
return SuggestedActionSetPasswordTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionSetPassword) TypeName() string {
return "suggestedActionSetPassword"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionSetPassword) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionSetPassword",
ID: SuggestedActionSetPasswordTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "AuthorizationDelay",
SchemaName: "authorization_delay",
},
}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionSetPassword) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetPassword#6f147d98 as nil")
}
b.PutID(SuggestedActionSetPasswordTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionSetPassword) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetPassword#6f147d98 as nil")
}
b.PutInt32(s.AuthorizationDelay)
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionSetPassword) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetPassword#6f147d98 to nil")
}
if err := b.ConsumeID(SuggestedActionSetPasswordTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionSetPassword) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetPassword#6f147d98 to nil")
}
{
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: field authorization_delay: %w", err)
}
s.AuthorizationDelay = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionSetPassword) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetPassword#6f147d98 as nil")
}
b.ObjStart()
b.PutID("suggestedActionSetPassword")
b.Comma()
b.FieldStart("authorization_delay")
b.PutInt32(s.AuthorizationDelay)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionSetPassword) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetPassword#6f147d98 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionSetPassword"); err != nil {
return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: %w", err)
}
case "authorization_delay":
value, err := b.Int32()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: field authorization_delay: %w", err)
}
s.AuthorizationDelay = value
default:
return b.Skip()
}
return nil
})
}
// GetAuthorizationDelay returns value of AuthorizationDelay field.
func (s *SuggestedActionSetPassword) GetAuthorizationDelay() (value int32) {
if s == nil {
return
}
return s.AuthorizationDelay
}
// SuggestedActionUpgradePremium represents TL type `suggestedActionUpgradePremium#70aa79fb`.
type SuggestedActionUpgradePremium struct {
}
// SuggestedActionUpgradePremiumTypeID is TL type id of SuggestedActionUpgradePremium.
const SuggestedActionUpgradePremiumTypeID = 0x70aa79fb
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionUpgradePremium) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionUpgradePremium.
var (
_ bin.Encoder = &SuggestedActionUpgradePremium{}
_ bin.Decoder = &SuggestedActionUpgradePremium{}
_ bin.BareEncoder = &SuggestedActionUpgradePremium{}
_ bin.BareDecoder = &SuggestedActionUpgradePremium{}
_ SuggestedActionClass = &SuggestedActionUpgradePremium{}
)
func (s *SuggestedActionUpgradePremium) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionUpgradePremium) String() string {
if s == nil {
return "SuggestedActionUpgradePremium(nil)"
}
type Alias SuggestedActionUpgradePremium
return fmt.Sprintf("SuggestedActionUpgradePremium%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionUpgradePremium) TypeID() uint32 {
return SuggestedActionUpgradePremiumTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionUpgradePremium) TypeName() string {
return "suggestedActionUpgradePremium"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionUpgradePremium) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionUpgradePremium",
ID: SuggestedActionUpgradePremiumTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionUpgradePremium) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionUpgradePremium#70aa79fb as nil")
}
b.PutID(SuggestedActionUpgradePremiumTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionUpgradePremium) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionUpgradePremium#70aa79fb as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionUpgradePremium) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionUpgradePremium#70aa79fb to nil")
}
if err := b.ConsumeID(SuggestedActionUpgradePremiumTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionUpgradePremium#70aa79fb: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionUpgradePremium) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionUpgradePremium#70aa79fb to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionUpgradePremium) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionUpgradePremium#70aa79fb as nil")
}
b.ObjStart()
b.PutID("suggestedActionUpgradePremium")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionUpgradePremium) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionUpgradePremium#70aa79fb to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionUpgradePremium"); err != nil {
return fmt.Errorf("unable to decode suggestedActionUpgradePremium#70aa79fb: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionRestorePremium represents TL type `suggestedActionRestorePremium#e909dd64`.
type SuggestedActionRestorePremium struct {
}
// SuggestedActionRestorePremiumTypeID is TL type id of SuggestedActionRestorePremium.
const SuggestedActionRestorePremiumTypeID = 0xe909dd64
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionRestorePremium) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionRestorePremium.
var (
_ bin.Encoder = &SuggestedActionRestorePremium{}
_ bin.Decoder = &SuggestedActionRestorePremium{}
_ bin.BareEncoder = &SuggestedActionRestorePremium{}
_ bin.BareDecoder = &SuggestedActionRestorePremium{}
_ SuggestedActionClass = &SuggestedActionRestorePremium{}
)
func (s *SuggestedActionRestorePremium) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionRestorePremium) String() string {
if s == nil {
return "SuggestedActionRestorePremium(nil)"
}
type Alias SuggestedActionRestorePremium
return fmt.Sprintf("SuggestedActionRestorePremium%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionRestorePremium) TypeID() uint32 {
return SuggestedActionRestorePremiumTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionRestorePremium) TypeName() string {
return "suggestedActionRestorePremium"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionRestorePremium) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionRestorePremium",
ID: SuggestedActionRestorePremiumTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionRestorePremium) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionRestorePremium#e909dd64 as nil")
}
b.PutID(SuggestedActionRestorePremiumTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionRestorePremium) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionRestorePremium#e909dd64 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionRestorePremium) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionRestorePremium#e909dd64 to nil")
}
if err := b.ConsumeID(SuggestedActionRestorePremiumTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionRestorePremium#e909dd64: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionRestorePremium) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionRestorePremium#e909dd64 to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionRestorePremium) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionRestorePremium#e909dd64 as nil")
}
b.ObjStart()
b.PutID("suggestedActionRestorePremium")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionRestorePremium) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionRestorePremium#e909dd64 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionRestorePremium"); err != nil {
return fmt.Errorf("unable to decode suggestedActionRestorePremium#e909dd64: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionSubscribeToAnnualPremium represents TL type `suggestedActionSubscribeToAnnualPremium#164978bb`.
type SuggestedActionSubscribeToAnnualPremium struct {
}
// SuggestedActionSubscribeToAnnualPremiumTypeID is TL type id of SuggestedActionSubscribeToAnnualPremium.
const SuggestedActionSubscribeToAnnualPremiumTypeID = 0x164978bb
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionSubscribeToAnnualPremium) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionSubscribeToAnnualPremium.
var (
_ bin.Encoder = &SuggestedActionSubscribeToAnnualPremium{}
_ bin.Decoder = &SuggestedActionSubscribeToAnnualPremium{}
_ bin.BareEncoder = &SuggestedActionSubscribeToAnnualPremium{}
_ bin.BareDecoder = &SuggestedActionSubscribeToAnnualPremium{}
_ SuggestedActionClass = &SuggestedActionSubscribeToAnnualPremium{}
)
func (s *SuggestedActionSubscribeToAnnualPremium) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionSubscribeToAnnualPremium) String() string {
if s == nil {
return "SuggestedActionSubscribeToAnnualPremium(nil)"
}
type Alias SuggestedActionSubscribeToAnnualPremium
return fmt.Sprintf("SuggestedActionSubscribeToAnnualPremium%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionSubscribeToAnnualPremium) TypeID() uint32 {
return SuggestedActionSubscribeToAnnualPremiumTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionSubscribeToAnnualPremium) TypeName() string {
return "suggestedActionSubscribeToAnnualPremium"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionSubscribeToAnnualPremium) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionSubscribeToAnnualPremium",
ID: SuggestedActionSubscribeToAnnualPremiumTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionSubscribeToAnnualPremium) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSubscribeToAnnualPremium#164978bb as nil")
}
b.PutID(SuggestedActionSubscribeToAnnualPremiumTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionSubscribeToAnnualPremium) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSubscribeToAnnualPremium#164978bb as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionSubscribeToAnnualPremium) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSubscribeToAnnualPremium#164978bb to nil")
}
if err := b.ConsumeID(SuggestedActionSubscribeToAnnualPremiumTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionSubscribeToAnnualPremium#164978bb: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionSubscribeToAnnualPremium) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSubscribeToAnnualPremium#164978bb to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionSubscribeToAnnualPremium) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSubscribeToAnnualPremium#164978bb as nil")
}
b.ObjStart()
b.PutID("suggestedActionSubscribeToAnnualPremium")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionSubscribeToAnnualPremium) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSubscribeToAnnualPremium#164978bb to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionSubscribeToAnnualPremium"); err != nil {
return fmt.Errorf("unable to decode suggestedActionSubscribeToAnnualPremium#164978bb: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionGiftPremiumForChristmas represents TL type `suggestedActionGiftPremiumForChristmas#93b3ee6f`.
type SuggestedActionGiftPremiumForChristmas struct {
}
// SuggestedActionGiftPremiumForChristmasTypeID is TL type id of SuggestedActionGiftPremiumForChristmas.
const SuggestedActionGiftPremiumForChristmasTypeID = 0x93b3ee6f
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionGiftPremiumForChristmas) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionGiftPremiumForChristmas.
var (
_ bin.Encoder = &SuggestedActionGiftPremiumForChristmas{}
_ bin.Decoder = &SuggestedActionGiftPremiumForChristmas{}
_ bin.BareEncoder = &SuggestedActionGiftPremiumForChristmas{}
_ bin.BareDecoder = &SuggestedActionGiftPremiumForChristmas{}
_ SuggestedActionClass = &SuggestedActionGiftPremiumForChristmas{}
)
func (s *SuggestedActionGiftPremiumForChristmas) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionGiftPremiumForChristmas) String() string {
if s == nil {
return "SuggestedActionGiftPremiumForChristmas(nil)"
}
type Alias SuggestedActionGiftPremiumForChristmas
return fmt.Sprintf("SuggestedActionGiftPremiumForChristmas%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionGiftPremiumForChristmas) TypeID() uint32 {
return SuggestedActionGiftPremiumForChristmasTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionGiftPremiumForChristmas) TypeName() string {
return "suggestedActionGiftPremiumForChristmas"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionGiftPremiumForChristmas) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionGiftPremiumForChristmas",
ID: SuggestedActionGiftPremiumForChristmasTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionGiftPremiumForChristmas) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionGiftPremiumForChristmas#93b3ee6f as nil")
}
b.PutID(SuggestedActionGiftPremiumForChristmasTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionGiftPremiumForChristmas) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionGiftPremiumForChristmas#93b3ee6f as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionGiftPremiumForChristmas) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionGiftPremiumForChristmas#93b3ee6f to nil")
}
if err := b.ConsumeID(SuggestedActionGiftPremiumForChristmasTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionGiftPremiumForChristmas#93b3ee6f: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionGiftPremiumForChristmas) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionGiftPremiumForChristmas#93b3ee6f to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionGiftPremiumForChristmas) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionGiftPremiumForChristmas#93b3ee6f as nil")
}
b.ObjStart()
b.PutID("suggestedActionGiftPremiumForChristmas")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionGiftPremiumForChristmas) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionGiftPremiumForChristmas#93b3ee6f to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionGiftPremiumForChristmas"); err != nil {
return fmt.Errorf("unable to decode suggestedActionGiftPremiumForChristmas#93b3ee6f: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionSetBirthdate represents TL type `suggestedActionSetBirthdate#eabd9b02`.
type SuggestedActionSetBirthdate struct {
}
// SuggestedActionSetBirthdateTypeID is TL type id of SuggestedActionSetBirthdate.
const SuggestedActionSetBirthdateTypeID = 0xeabd9b02
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionSetBirthdate) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionSetBirthdate.
var (
_ bin.Encoder = &SuggestedActionSetBirthdate{}
_ bin.Decoder = &SuggestedActionSetBirthdate{}
_ bin.BareEncoder = &SuggestedActionSetBirthdate{}
_ bin.BareDecoder = &SuggestedActionSetBirthdate{}
_ SuggestedActionClass = &SuggestedActionSetBirthdate{}
)
func (s *SuggestedActionSetBirthdate) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionSetBirthdate) String() string {
if s == nil {
return "SuggestedActionSetBirthdate(nil)"
}
type Alias SuggestedActionSetBirthdate
return fmt.Sprintf("SuggestedActionSetBirthdate%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionSetBirthdate) TypeID() uint32 {
return SuggestedActionSetBirthdateTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionSetBirthdate) TypeName() string {
return "suggestedActionSetBirthdate"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionSetBirthdate) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionSetBirthdate",
ID: SuggestedActionSetBirthdateTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionSetBirthdate) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetBirthdate#eabd9b02 as nil")
}
b.PutID(SuggestedActionSetBirthdateTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionSetBirthdate) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetBirthdate#eabd9b02 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionSetBirthdate) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetBirthdate#eabd9b02 to nil")
}
if err := b.ConsumeID(SuggestedActionSetBirthdateTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionSetBirthdate#eabd9b02: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionSetBirthdate) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetBirthdate#eabd9b02 to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionSetBirthdate) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetBirthdate#eabd9b02 as nil")
}
b.ObjStart()
b.PutID("suggestedActionSetBirthdate")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionSetBirthdate) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetBirthdate#eabd9b02 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionSetBirthdate"); err != nil {
return fmt.Errorf("unable to decode suggestedActionSetBirthdate#eabd9b02: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionSetProfilePhoto represents TL type `suggestedActionSetProfilePhoto#9fe23d6b`.
type SuggestedActionSetProfilePhoto struct {
}
// SuggestedActionSetProfilePhotoTypeID is TL type id of SuggestedActionSetProfilePhoto.
const SuggestedActionSetProfilePhotoTypeID = 0x9fe23d6b
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionSetProfilePhoto) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionSetProfilePhoto.
var (
_ bin.Encoder = &SuggestedActionSetProfilePhoto{}
_ bin.Decoder = &SuggestedActionSetProfilePhoto{}
_ bin.BareEncoder = &SuggestedActionSetProfilePhoto{}
_ bin.BareDecoder = &SuggestedActionSetProfilePhoto{}
_ SuggestedActionClass = &SuggestedActionSetProfilePhoto{}
)
func (s *SuggestedActionSetProfilePhoto) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionSetProfilePhoto) String() string {
if s == nil {
return "SuggestedActionSetProfilePhoto(nil)"
}
type Alias SuggestedActionSetProfilePhoto
return fmt.Sprintf("SuggestedActionSetProfilePhoto%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionSetProfilePhoto) TypeID() uint32 {
return SuggestedActionSetProfilePhotoTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionSetProfilePhoto) TypeName() string {
return "suggestedActionSetProfilePhoto"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionSetProfilePhoto) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionSetProfilePhoto",
ID: SuggestedActionSetProfilePhotoTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionSetProfilePhoto) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil")
}
b.PutID(SuggestedActionSetProfilePhotoTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionSetProfilePhoto) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionSetProfilePhoto) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil")
}
if err := b.ConsumeID(SuggestedActionSetProfilePhotoTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionSetProfilePhoto#9fe23d6b: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionSetProfilePhoto) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionSetProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil")
}
b.ObjStart()
b.PutID("suggestedActionSetProfilePhoto")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionSetProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionSetProfilePhoto"); err != nil {
return fmt.Errorf("unable to decode suggestedActionSetProfilePhoto#9fe23d6b: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionExtendPremium represents TL type `suggestedActionExtendPremium#de405cca`.
type SuggestedActionExtendPremium struct {
// A URL for managing Telegram Premium subscription
ManagePremiumSubscriptionURL string
}
// SuggestedActionExtendPremiumTypeID is TL type id of SuggestedActionExtendPremium.
const SuggestedActionExtendPremiumTypeID = 0xde405cca
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionExtendPremium) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionExtendPremium.
var (
_ bin.Encoder = &SuggestedActionExtendPremium{}
_ bin.Decoder = &SuggestedActionExtendPremium{}
_ bin.BareEncoder = &SuggestedActionExtendPremium{}
_ bin.BareDecoder = &SuggestedActionExtendPremium{}
_ SuggestedActionClass = &SuggestedActionExtendPremium{}
)
func (s *SuggestedActionExtendPremium) Zero() bool {
if s == nil {
return true
}
if !(s.ManagePremiumSubscriptionURL == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionExtendPremium) String() string {
if s == nil {
return "SuggestedActionExtendPremium(nil)"
}
type Alias SuggestedActionExtendPremium
return fmt.Sprintf("SuggestedActionExtendPremium%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionExtendPremium) TypeID() uint32 {
return SuggestedActionExtendPremiumTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionExtendPremium) TypeName() string {
return "suggestedActionExtendPremium"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionExtendPremium) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionExtendPremium",
ID: SuggestedActionExtendPremiumTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "ManagePremiumSubscriptionURL",
SchemaName: "manage_premium_subscription_url",
},
}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionExtendPremium) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil")
}
b.PutID(SuggestedActionExtendPremiumTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionExtendPremium) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil")
}
b.PutString(s.ManagePremiumSubscriptionURL)
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionExtendPremium) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil")
}
if err := b.ConsumeID(SuggestedActionExtendPremiumTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionExtendPremium) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: field manage_premium_subscription_url: %w", err)
}
s.ManagePremiumSubscriptionURL = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionExtendPremium) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil")
}
b.ObjStart()
b.PutID("suggestedActionExtendPremium")
b.Comma()
b.FieldStart("manage_premium_subscription_url")
b.PutString(s.ManagePremiumSubscriptionURL)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionExtendPremium) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionExtendPremium"); err != nil {
return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: %w", err)
}
case "manage_premium_subscription_url":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: field manage_premium_subscription_url: %w", err)
}
s.ManagePremiumSubscriptionURL = value
default:
return b.Skip()
}
return nil
})
}
// GetManagePremiumSubscriptionURL returns value of ManagePremiumSubscriptionURL field.
func (s *SuggestedActionExtendPremium) GetManagePremiumSubscriptionURL() (value string) {
if s == nil {
return
}
return s.ManagePremiumSubscriptionURL
}
// SuggestedActionExtendStarSubscriptions represents TL type `suggestedActionExtendStarSubscriptions#fd32d556`.
type SuggestedActionExtendStarSubscriptions struct {
}
// SuggestedActionExtendStarSubscriptionsTypeID is TL type id of SuggestedActionExtendStarSubscriptions.
const SuggestedActionExtendStarSubscriptionsTypeID = 0xfd32d556
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionExtendStarSubscriptions) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionExtendStarSubscriptions.
var (
_ bin.Encoder = &SuggestedActionExtendStarSubscriptions{}
_ bin.Decoder = &SuggestedActionExtendStarSubscriptions{}
_ bin.BareEncoder = &SuggestedActionExtendStarSubscriptions{}
_ bin.BareDecoder = &SuggestedActionExtendStarSubscriptions{}
_ SuggestedActionClass = &SuggestedActionExtendStarSubscriptions{}
)
func (s *SuggestedActionExtendStarSubscriptions) Zero() bool {
if s == nil {
return true
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionExtendStarSubscriptions) String() string {
if s == nil {
return "SuggestedActionExtendStarSubscriptions(nil)"
}
type Alias SuggestedActionExtendStarSubscriptions
return fmt.Sprintf("SuggestedActionExtendStarSubscriptions%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionExtendStarSubscriptions) TypeID() uint32 {
return SuggestedActionExtendStarSubscriptionsTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionExtendStarSubscriptions) TypeName() string {
return "suggestedActionExtendStarSubscriptions"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionExtendStarSubscriptions) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionExtendStarSubscriptions",
ID: SuggestedActionExtendStarSubscriptionsTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionExtendStarSubscriptions) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionExtendStarSubscriptions#fd32d556 as nil")
}
b.PutID(SuggestedActionExtendStarSubscriptionsTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionExtendStarSubscriptions) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionExtendStarSubscriptions#fd32d556 as nil")
}
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionExtendStarSubscriptions) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionExtendStarSubscriptions#fd32d556 to nil")
}
if err := b.ConsumeID(SuggestedActionExtendStarSubscriptionsTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionExtendStarSubscriptions#fd32d556: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionExtendStarSubscriptions) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionExtendStarSubscriptions#fd32d556 to nil")
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionExtendStarSubscriptions) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionExtendStarSubscriptions#fd32d556 as nil")
}
b.ObjStart()
b.PutID("suggestedActionExtendStarSubscriptions")
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionExtendStarSubscriptions) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionExtendStarSubscriptions#fd32d556 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionExtendStarSubscriptions"); err != nil {
return fmt.Errorf("unable to decode suggestedActionExtendStarSubscriptions#fd32d556: %w", err)
}
default:
return b.Skip()
}
return nil
})
}
// SuggestedActionCustom represents TL type `suggestedActionCustom#7cbec343`.
type SuggestedActionCustom struct {
// Unique name of the suggestion
Name string
// Title of the suggestion
Title FormattedText
// A custom suggestion to be shown at the top of the chat list
Description FormattedText
// The link to open when the suggestion is clicked
URL string
}
// SuggestedActionCustomTypeID is TL type id of SuggestedActionCustom.
const SuggestedActionCustomTypeID = 0x7cbec343
// construct implements constructor of SuggestedActionClass.
func (s SuggestedActionCustom) construct() SuggestedActionClass { return &s }
// Ensuring interfaces in compile-time for SuggestedActionCustom.
var (
_ bin.Encoder = &SuggestedActionCustom{}
_ bin.Decoder = &SuggestedActionCustom{}
_ bin.BareEncoder = &SuggestedActionCustom{}
_ bin.BareDecoder = &SuggestedActionCustom{}
_ SuggestedActionClass = &SuggestedActionCustom{}
)
func (s *SuggestedActionCustom) Zero() bool {
if s == nil {
return true
}
if !(s.Name == "") {
return false
}
if !(s.Title.Zero()) {
return false
}
if !(s.Description.Zero()) {
return false
}
if !(s.URL == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (s *SuggestedActionCustom) String() string {
if s == nil {
return "SuggestedActionCustom(nil)"
}
type Alias SuggestedActionCustom
return fmt.Sprintf("SuggestedActionCustom%+v", Alias(*s))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SuggestedActionCustom) TypeID() uint32 {
return SuggestedActionCustomTypeID
}
// TypeName returns name of type in TL schema.
func (*SuggestedActionCustom) TypeName() string {
return "suggestedActionCustom"
}
// TypeInfo returns info about TL type.
func (s *SuggestedActionCustom) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "suggestedActionCustom",
ID: SuggestedActionCustomTypeID,
}
if s == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Name",
SchemaName: "name",
},
{
Name: "Title",
SchemaName: "title",
},
{
Name: "Description",
SchemaName: "description",
},
{
Name: "URL",
SchemaName: "url",
},
}
return typ
}
// Encode implements bin.Encoder.
func (s *SuggestedActionCustom) Encode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCustom#7cbec343 as nil")
}
b.PutID(SuggestedActionCustomTypeID)
return s.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (s *SuggestedActionCustom) EncodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCustom#7cbec343 as nil")
}
b.PutString(s.Name)
if err := s.Title.Encode(b); err != nil {
return fmt.Errorf("unable to encode suggestedActionCustom#7cbec343: field title: %w", err)
}
if err := s.Description.Encode(b); err != nil {
return fmt.Errorf("unable to encode suggestedActionCustom#7cbec343: field description: %w", err)
}
b.PutString(s.URL)
return nil
}
// Decode implements bin.Decoder.
func (s *SuggestedActionCustom) Decode(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCustom#7cbec343 to nil")
}
if err := b.ConsumeID(SuggestedActionCustomTypeID); err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: %w", err)
}
return s.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (s *SuggestedActionCustom) DecodeBare(b *bin.Buffer) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCustom#7cbec343 to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field name: %w", err)
}
s.Name = value
}
{
if err := s.Title.Decode(b); err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field title: %w", err)
}
}
{
if err := s.Description.Decode(b); err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field description: %w", err)
}
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field url: %w", err)
}
s.URL = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *SuggestedActionCustom) EncodeTDLibJSON(b tdjson.Encoder) error {
if s == nil {
return fmt.Errorf("can't encode suggestedActionCustom#7cbec343 as nil")
}
b.ObjStart()
b.PutID("suggestedActionCustom")
b.Comma()
b.FieldStart("name")
b.PutString(s.Name)
b.Comma()
b.FieldStart("title")
if err := s.Title.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode suggestedActionCustom#7cbec343: field title: %w", err)
}
b.Comma()
b.FieldStart("description")
if err := s.Description.EncodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to encode suggestedActionCustom#7cbec343: field description: %w", err)
}
b.Comma()
b.FieldStart("url")
b.PutString(s.URL)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *SuggestedActionCustom) DecodeTDLibJSON(b tdjson.Decoder) error {
if s == nil {
return fmt.Errorf("can't decode suggestedActionCustom#7cbec343 to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("suggestedActionCustom"); err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: %w", err)
}
case "name":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field name: %w", err)
}
s.Name = value
case "title":
if err := s.Title.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field title: %w", err)
}
case "description":
if err := s.Description.DecodeTDLibJSON(b); err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field description: %w", err)
}
case "url":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode suggestedActionCustom#7cbec343: field url: %w", err)
}
s.URL = value
default:
return b.Skip()
}
return nil
})
}
// GetName returns value of Name field.
func (s *SuggestedActionCustom) GetName() (value string) {
if s == nil {
return
}
return s.Name
}
// GetTitle returns value of Title field.
func (s *SuggestedActionCustom) GetTitle() (value FormattedText) {
if s == nil {
return
}
return s.Title
}
// GetDescription returns value of Description field.
func (s *SuggestedActionCustom) GetDescription() (value FormattedText) {
if s == nil {
return
}
return s.Description
}
// GetURL returns value of URL field.
func (s *SuggestedActionCustom) GetURL() (value string) {
if s == nil {
return
}
return s.URL
}
// SuggestedActionClassName is schema name of SuggestedActionClass.
const SuggestedActionClassName = "SuggestedAction"
// SuggestedActionClass represents SuggestedAction generic type.
//
// Example:
//
// g, err := tdapi.DecodeSuggestedAction(buf)
// if err != nil {
// panic(err)
// }
// switch v := g.(type) {
// case *tdapi.SuggestedActionEnableArchiveAndMuteNewChats: // suggestedActionEnableArchiveAndMuteNewChats#7841ec4f
// case *tdapi.SuggestedActionCheckPassword: // suggestedActionCheckPassword#71e072b7
// case *tdapi.SuggestedActionCheckPhoneNumber: // suggestedActionCheckPhoneNumber#26ab77eb
// case *tdapi.SuggestedActionViewChecksHint: // suggestedActionViewChecksHint#35203547
// case *tdapi.SuggestedActionConvertToBroadcastGroup: // suggestedActionConvertToBroadcastGroup#c67a2e38
// case *tdapi.SuggestedActionSetPassword: // suggestedActionSetPassword#6f147d98
// case *tdapi.SuggestedActionUpgradePremium: // suggestedActionUpgradePremium#70aa79fb
// case *tdapi.SuggestedActionRestorePremium: // suggestedActionRestorePremium#e909dd64
// case *tdapi.SuggestedActionSubscribeToAnnualPremium: // suggestedActionSubscribeToAnnualPremium#164978bb
// case *tdapi.SuggestedActionGiftPremiumForChristmas: // suggestedActionGiftPremiumForChristmas#93b3ee6f
// case *tdapi.SuggestedActionSetBirthdate: // suggestedActionSetBirthdate#eabd9b02
// case *tdapi.SuggestedActionSetProfilePhoto: // suggestedActionSetProfilePhoto#9fe23d6b
// case *tdapi.SuggestedActionExtendPremium: // suggestedActionExtendPremium#de405cca
// case *tdapi.SuggestedActionExtendStarSubscriptions: // suggestedActionExtendStarSubscriptions#fd32d556
// case *tdapi.SuggestedActionCustom: // suggestedActionCustom#7cbec343
// default: panic(v)
// }
type SuggestedActionClass interface {
bin.Encoder
bin.Decoder
bin.BareEncoder
bin.BareDecoder
construct() SuggestedActionClass
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
TypeID() uint32
// TypeName returns name of type in TL schema.
TypeName() string
// String implements fmt.Stringer.
String() string
// Zero returns true if current object has a zero value.
Zero() bool
EncodeTDLibJSON(b tdjson.Encoder) error
DecodeTDLibJSON(b tdjson.Decoder) error
}
// DecodeSuggestedAction implements binary de-serialization for SuggestedActionClass.
func DecodeSuggestedAction(buf *bin.Buffer) (SuggestedActionClass, error) {
id, err := buf.PeekID()
if err != nil {
return nil, err
}
switch id {
case SuggestedActionEnableArchiveAndMuteNewChatsTypeID:
// Decoding suggestedActionEnableArchiveAndMuteNewChats#7841ec4f.
v := SuggestedActionEnableArchiveAndMuteNewChats{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionCheckPasswordTypeID:
// Decoding suggestedActionCheckPassword#71e072b7.
v := SuggestedActionCheckPassword{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionCheckPhoneNumberTypeID:
// Decoding suggestedActionCheckPhoneNumber#26ab77eb.
v := SuggestedActionCheckPhoneNumber{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionViewChecksHintTypeID:
// Decoding suggestedActionViewChecksHint#35203547.
v := SuggestedActionViewChecksHint{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionConvertToBroadcastGroupTypeID:
// Decoding suggestedActionConvertToBroadcastGroup#c67a2e38.
v := SuggestedActionConvertToBroadcastGroup{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionSetPasswordTypeID:
// Decoding suggestedActionSetPassword#6f147d98.
v := SuggestedActionSetPassword{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionUpgradePremiumTypeID:
// Decoding suggestedActionUpgradePremium#70aa79fb.
v := SuggestedActionUpgradePremium{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionRestorePremiumTypeID:
// Decoding suggestedActionRestorePremium#e909dd64.
v := SuggestedActionRestorePremium{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionSubscribeToAnnualPremiumTypeID:
// Decoding suggestedActionSubscribeToAnnualPremium#164978bb.
v := SuggestedActionSubscribeToAnnualPremium{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionGiftPremiumForChristmasTypeID:
// Decoding suggestedActionGiftPremiumForChristmas#93b3ee6f.
v := SuggestedActionGiftPremiumForChristmas{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionSetBirthdateTypeID:
// Decoding suggestedActionSetBirthdate#eabd9b02.
v := SuggestedActionSetBirthdate{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionSetProfilePhotoTypeID:
// Decoding suggestedActionSetProfilePhoto#9fe23d6b.
v := SuggestedActionSetProfilePhoto{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionExtendPremiumTypeID:
// Decoding suggestedActionExtendPremium#de405cca.
v := SuggestedActionExtendPremium{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionExtendStarSubscriptionsTypeID:
// Decoding suggestedActionExtendStarSubscriptions#fd32d556.
v := SuggestedActionExtendStarSubscriptions{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case SuggestedActionCustomTypeID:
// Decoding suggestedActionCustom#7cbec343.
v := SuggestedActionCustom{}
if err := v.Decode(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
default:
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", bin.NewUnexpectedID(id))
}
}
// DecodeTDLibJSONSuggestedAction implements binary de-serialization for SuggestedActionClass.
func DecodeTDLibJSONSuggestedAction(buf tdjson.Decoder) (SuggestedActionClass, error) {
id, err := buf.FindTypeID()
if err != nil {
return nil, err
}
switch id {
case "suggestedActionEnableArchiveAndMuteNewChats":
// Decoding suggestedActionEnableArchiveAndMuteNewChats#7841ec4f.
v := SuggestedActionEnableArchiveAndMuteNewChats{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionCheckPassword":
// Decoding suggestedActionCheckPassword#71e072b7.
v := SuggestedActionCheckPassword{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionCheckPhoneNumber":
// Decoding suggestedActionCheckPhoneNumber#26ab77eb.
v := SuggestedActionCheckPhoneNumber{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionViewChecksHint":
// Decoding suggestedActionViewChecksHint#35203547.
v := SuggestedActionViewChecksHint{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionConvertToBroadcastGroup":
// Decoding suggestedActionConvertToBroadcastGroup#c67a2e38.
v := SuggestedActionConvertToBroadcastGroup{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionSetPassword":
// Decoding suggestedActionSetPassword#6f147d98.
v := SuggestedActionSetPassword{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionUpgradePremium":
// Decoding suggestedActionUpgradePremium#70aa79fb.
v := SuggestedActionUpgradePremium{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionRestorePremium":
// Decoding suggestedActionRestorePremium#e909dd64.
v := SuggestedActionRestorePremium{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionSubscribeToAnnualPremium":
// Decoding suggestedActionSubscribeToAnnualPremium#164978bb.
v := SuggestedActionSubscribeToAnnualPremium{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionGiftPremiumForChristmas":
// Decoding suggestedActionGiftPremiumForChristmas#93b3ee6f.
v := SuggestedActionGiftPremiumForChristmas{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionSetBirthdate":
// Decoding suggestedActionSetBirthdate#eabd9b02.
v := SuggestedActionSetBirthdate{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionSetProfilePhoto":
// Decoding suggestedActionSetProfilePhoto#9fe23d6b.
v := SuggestedActionSetProfilePhoto{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionExtendPremium":
// Decoding suggestedActionExtendPremium#de405cca.
v := SuggestedActionExtendPremium{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionExtendStarSubscriptions":
// Decoding suggestedActionExtendStarSubscriptions#fd32d556.
v := SuggestedActionExtendStarSubscriptions{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
case "suggestedActionCustom":
// Decoding suggestedActionCustom#7cbec343.
v := SuggestedActionCustom{}
if err := v.DecodeTDLibJSON(buf); err != nil {
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err)
}
return &v, nil
default:
return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", tdjson.NewUnexpectedID(id))
}
}
// SuggestedAction boxes the SuggestedActionClass providing a helper.
type SuggestedActionBox struct {
SuggestedAction SuggestedActionClass
}
// Decode implements bin.Decoder for SuggestedActionBox.
func (b *SuggestedActionBox) Decode(buf *bin.Buffer) error {
if b == nil {
return fmt.Errorf("unable to decode SuggestedActionBox to nil")
}
v, err := DecodeSuggestedAction(buf)
if err != nil {
return fmt.Errorf("unable to decode boxed value: %w", err)
}
b.SuggestedAction = v
return nil
}
// Encode implements bin.Encode for SuggestedActionBox.
func (b *SuggestedActionBox) Encode(buf *bin.Buffer) error {
if b == nil || b.SuggestedAction == nil {
return fmt.Errorf("unable to encode SuggestedActionClass as nil")
}
return b.SuggestedAction.Encode(buf)
}
// DecodeTDLibJSON implements bin.Decoder for SuggestedActionBox.
func (b *SuggestedActionBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
if b == nil {
return fmt.Errorf("unable to decode SuggestedActionBox to nil")
}
v, err := DecodeTDLibJSONSuggestedAction(buf)
if err != nil {
return fmt.Errorf("unable to decode boxed value: %w", err)
}
b.SuggestedAction = v
return nil
}
// EncodeTDLibJSON implements bin.Encode for SuggestedActionBox.
func (b *SuggestedActionBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
if b == nil || b.SuggestedAction == nil {
return fmt.Errorf("unable to encode SuggestedActionClass as nil")
}
return b.SuggestedAction.EncodeTDLibJSON(buf)
}