package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type KeyboardButton struct {
Text string
}
const KeyboardButtonTypeID = 0xa2fa4880
func (k KeyboardButton ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButton {}
_ bin .Decoder = &KeyboardButton {}
_ bin .BareEncoder = &KeyboardButton {}
_ bin .BareDecoder = &KeyboardButton {}
_ KeyboardButtonClass = &KeyboardButton {}
)
func (k *KeyboardButton ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
return true
}
func (k *KeyboardButton ) String () string {
if k == nil {
return "KeyboardButton(nil)"
}
type Alias KeyboardButton
return fmt .Sprintf ("KeyboardButton%+v" , Alias (*k ))
}
func (k *KeyboardButton ) FillFrom (from interface {
GetText () (value string )
}) {
k .Text = from .GetText ()
}
func (*KeyboardButton ) TypeID () uint32 {
return KeyboardButtonTypeID
}
func (*KeyboardButton ) TypeName () string {
return "keyboardButton"
}
func (k *KeyboardButton ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButton" ,
ID : KeyboardButtonTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (k *KeyboardButton ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButton#a2fa4880 as nil" )
}
b .PutID (KeyboardButtonTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButton ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButton#a2fa4880 as nil" )
}
b .PutString (k .Text )
return nil
}
func (k *KeyboardButton ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButton#a2fa4880 to nil" )
}
if err := b .ConsumeID (KeyboardButtonTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButton#a2fa4880: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButton ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButton#a2fa4880 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButton#a2fa4880: field text: %w" , err )
}
k .Text = value
}
return nil
}
func (k *KeyboardButton ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
type KeyboardButtonURL struct {
Text string
URL string
}
const KeyboardButtonURLTypeID = 0x258aff05
func (k KeyboardButtonURL ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonURL {}
_ bin .Decoder = &KeyboardButtonURL {}
_ bin .BareEncoder = &KeyboardButtonURL {}
_ bin .BareDecoder = &KeyboardButtonURL {}
_ KeyboardButtonClass = &KeyboardButtonURL {}
)
func (k *KeyboardButtonURL ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
if !(k .URL == "" ) {
return false
}
return true
}
func (k *KeyboardButtonURL ) String () string {
if k == nil {
return "KeyboardButtonURL(nil)"
}
type Alias KeyboardButtonURL
return fmt .Sprintf ("KeyboardButtonURL%+v" , Alias (*k ))
}
func (k *KeyboardButtonURL ) FillFrom (from interface {
GetText () (value string )
GetURL () (value string )
}) {
k .Text = from .GetText ()
k .URL = from .GetURL ()
}
func (*KeyboardButtonURL ) TypeID () uint32 {
return KeyboardButtonURLTypeID
}
func (*KeyboardButtonURL ) TypeName () string {
return "keyboardButtonUrl"
}
func (k *KeyboardButtonURL ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonUrl" ,
ID : KeyboardButtonURLTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (k *KeyboardButtonURL ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonUrl#258aff05 as nil" )
}
b .PutID (KeyboardButtonURLTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonURL ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonUrl#258aff05 as nil" )
}
b .PutString (k .Text )
b .PutString (k .URL )
return nil
}
func (k *KeyboardButtonURL ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonUrl#258aff05 to nil" )
}
if err := b .ConsumeID (KeyboardButtonURLTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrl#258aff05: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonURL ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonUrl#258aff05 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrl#258aff05: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrl#258aff05: field url: %w" , err )
}
k .URL = value
}
return nil
}
func (k *KeyboardButtonURL ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonURL ) GetURL () (value string ) {
if k == nil {
return
}
return k .URL
}
type KeyboardButtonCallback struct {
Flags bin .Fields
RequiresPassword bool
Text string
Data []byte
}
const KeyboardButtonCallbackTypeID = 0x35bbdb6b
func (k KeyboardButtonCallback ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonCallback {}
_ bin .Decoder = &KeyboardButtonCallback {}
_ bin .BareEncoder = &KeyboardButtonCallback {}
_ bin .BareDecoder = &KeyboardButtonCallback {}
_ KeyboardButtonClass = &KeyboardButtonCallback {}
)
func (k *KeyboardButtonCallback ) Zero () bool {
if k == nil {
return true
}
if !(k .Flags .Zero ()) {
return false
}
if !(k .RequiresPassword == false ) {
return false
}
if !(k .Text == "" ) {
return false
}
if !(k .Data == nil ) {
return false
}
return true
}
func (k *KeyboardButtonCallback ) String () string {
if k == nil {
return "KeyboardButtonCallback(nil)"
}
type Alias KeyboardButtonCallback
return fmt .Sprintf ("KeyboardButtonCallback%+v" , Alias (*k ))
}
func (k *KeyboardButtonCallback ) FillFrom (from interface {
GetRequiresPassword () (value bool )
GetText () (value string )
GetData () (value []byte )
}) {
k .RequiresPassword = from .GetRequiresPassword ()
k .Text = from .GetText ()
k .Data = from .GetData ()
}
func (*KeyboardButtonCallback ) TypeID () uint32 {
return KeyboardButtonCallbackTypeID
}
func (*KeyboardButtonCallback ) TypeName () string {
return "keyboardButtonCallback"
}
func (k *KeyboardButtonCallback ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonCallback" ,
ID : KeyboardButtonCallbackTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "RequiresPassword" ,
SchemaName : "requires_password" ,
Null : !k .Flags .Has (0 ),
},
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "Data" ,
SchemaName : "data" ,
},
}
return typ
}
func (k *KeyboardButtonCallback ) SetFlags () {
if !(k .RequiresPassword == false ) {
k .Flags .Set (0 )
}
}
func (k *KeyboardButtonCallback ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonCallback#35bbdb6b as nil" )
}
b .PutID (KeyboardButtonCallbackTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonCallback ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonCallback#35bbdb6b as nil" )
}
k .SetFlags ()
if err := k .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode keyboardButtonCallback#35bbdb6b: field flags: %w" , err )
}
b .PutString (k .Text )
b .PutBytes (k .Data )
return nil
}
func (k *KeyboardButtonCallback ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonCallback#35bbdb6b to nil" )
}
if err := b .ConsumeID (KeyboardButtonCallbackTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonCallback#35bbdb6b: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonCallback ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonCallback#35bbdb6b to nil" )
}
{
if err := k .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonCallback#35bbdb6b: field flags: %w" , err )
}
}
k .RequiresPassword = k .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonCallback#35bbdb6b: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonCallback#35bbdb6b: field data: %w" , err )
}
k .Data = value
}
return nil
}
func (k *KeyboardButtonCallback ) SetRequiresPassword (value bool ) {
if value {
k .Flags .Set (0 )
k .RequiresPassword = true
} else {
k .Flags .Unset (0 )
k .RequiresPassword = false
}
}
func (k *KeyboardButtonCallback ) GetRequiresPassword () (value bool ) {
if k == nil {
return
}
return k .Flags .Has (0 )
}
func (k *KeyboardButtonCallback ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonCallback ) GetData () (value []byte ) {
if k == nil {
return
}
return k .Data
}
type KeyboardButtonRequestPhone struct {
Text string
}
const KeyboardButtonRequestPhoneTypeID = 0xb16a6c29
func (k KeyboardButtonRequestPhone ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonRequestPhone {}
_ bin .Decoder = &KeyboardButtonRequestPhone {}
_ bin .BareEncoder = &KeyboardButtonRequestPhone {}
_ bin .BareDecoder = &KeyboardButtonRequestPhone {}
_ KeyboardButtonClass = &KeyboardButtonRequestPhone {}
)
func (k *KeyboardButtonRequestPhone ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
return true
}
func (k *KeyboardButtonRequestPhone ) String () string {
if k == nil {
return "KeyboardButtonRequestPhone(nil)"
}
type Alias KeyboardButtonRequestPhone
return fmt .Sprintf ("KeyboardButtonRequestPhone%+v" , Alias (*k ))
}
func (k *KeyboardButtonRequestPhone ) FillFrom (from interface {
GetText () (value string )
}) {
k .Text = from .GetText ()
}
func (*KeyboardButtonRequestPhone ) TypeID () uint32 {
return KeyboardButtonRequestPhoneTypeID
}
func (*KeyboardButtonRequestPhone ) TypeName () string {
return "keyboardButtonRequestPhone"
}
func (k *KeyboardButtonRequestPhone ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonRequestPhone" ,
ID : KeyboardButtonRequestPhoneTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (k *KeyboardButtonRequestPhone ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestPhone#b16a6c29 as nil" )
}
b .PutID (KeyboardButtonRequestPhoneTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonRequestPhone ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestPhone#b16a6c29 as nil" )
}
b .PutString (k .Text )
return nil
}
func (k *KeyboardButtonRequestPhone ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestPhone#b16a6c29 to nil" )
}
if err := b .ConsumeID (KeyboardButtonRequestPhoneTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPhone#b16a6c29: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonRequestPhone ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestPhone#b16a6c29 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPhone#b16a6c29: field text: %w" , err )
}
k .Text = value
}
return nil
}
func (k *KeyboardButtonRequestPhone ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
type KeyboardButtonRequestGeoLocation struct {
Text string
}
const KeyboardButtonRequestGeoLocationTypeID = 0xfc796b3f
func (k KeyboardButtonRequestGeoLocation ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonRequestGeoLocation {}
_ bin .Decoder = &KeyboardButtonRequestGeoLocation {}
_ bin .BareEncoder = &KeyboardButtonRequestGeoLocation {}
_ bin .BareDecoder = &KeyboardButtonRequestGeoLocation {}
_ KeyboardButtonClass = &KeyboardButtonRequestGeoLocation {}
)
func (k *KeyboardButtonRequestGeoLocation ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
return true
}
func (k *KeyboardButtonRequestGeoLocation ) String () string {
if k == nil {
return "KeyboardButtonRequestGeoLocation(nil)"
}
type Alias KeyboardButtonRequestGeoLocation
return fmt .Sprintf ("KeyboardButtonRequestGeoLocation%+v" , Alias (*k ))
}
func (k *KeyboardButtonRequestGeoLocation ) FillFrom (from interface {
GetText () (value string )
}) {
k .Text = from .GetText ()
}
func (*KeyboardButtonRequestGeoLocation ) TypeID () uint32 {
return KeyboardButtonRequestGeoLocationTypeID
}
func (*KeyboardButtonRequestGeoLocation ) TypeName () string {
return "keyboardButtonRequestGeoLocation"
}
func (k *KeyboardButtonRequestGeoLocation ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonRequestGeoLocation" ,
ID : KeyboardButtonRequestGeoLocationTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (k *KeyboardButtonRequestGeoLocation ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestGeoLocation#fc796b3f as nil" )
}
b .PutID (KeyboardButtonRequestGeoLocationTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonRequestGeoLocation ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestGeoLocation#fc796b3f as nil" )
}
b .PutString (k .Text )
return nil
}
func (k *KeyboardButtonRequestGeoLocation ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestGeoLocation#fc796b3f to nil" )
}
if err := b .ConsumeID (KeyboardButtonRequestGeoLocationTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestGeoLocation#fc796b3f: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonRequestGeoLocation ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestGeoLocation#fc796b3f to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestGeoLocation#fc796b3f: field text: %w" , err )
}
k .Text = value
}
return nil
}
func (k *KeyboardButtonRequestGeoLocation ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
type KeyboardButtonSwitchInline struct {
Flags bin .Fields
SamePeer bool
Text string
Query string
PeerTypes []InlineQueryPeerTypeClass
}
const KeyboardButtonSwitchInlineTypeID = 0x93b9fbb5
func (k KeyboardButtonSwitchInline ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonSwitchInline {}
_ bin .Decoder = &KeyboardButtonSwitchInline {}
_ bin .BareEncoder = &KeyboardButtonSwitchInline {}
_ bin .BareDecoder = &KeyboardButtonSwitchInline {}
_ KeyboardButtonClass = &KeyboardButtonSwitchInline {}
)
func (k *KeyboardButtonSwitchInline ) Zero () bool {
if k == nil {
return true
}
if !(k .Flags .Zero ()) {
return false
}
if !(k .SamePeer == false ) {
return false
}
if !(k .Text == "" ) {
return false
}
if !(k .Query == "" ) {
return false
}
if !(k .PeerTypes == nil ) {
return false
}
return true
}
func (k *KeyboardButtonSwitchInline ) String () string {
if k == nil {
return "KeyboardButtonSwitchInline(nil)"
}
type Alias KeyboardButtonSwitchInline
return fmt .Sprintf ("KeyboardButtonSwitchInline%+v" , Alias (*k ))
}
func (k *KeyboardButtonSwitchInline ) FillFrom (from interface {
GetSamePeer () (value bool )
GetText () (value string )
GetQuery () (value string )
GetPeerTypes () (value []InlineQueryPeerTypeClass , ok bool )
}) {
k .SamePeer = from .GetSamePeer ()
k .Text = from .GetText ()
k .Query = from .GetQuery ()
if val , ok := from .GetPeerTypes (); ok {
k .PeerTypes = val
}
}
func (*KeyboardButtonSwitchInline ) TypeID () uint32 {
return KeyboardButtonSwitchInlineTypeID
}
func (*KeyboardButtonSwitchInline ) TypeName () string {
return "keyboardButtonSwitchInline"
}
func (k *KeyboardButtonSwitchInline ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonSwitchInline" ,
ID : KeyboardButtonSwitchInlineTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SamePeer" ,
SchemaName : "same_peer" ,
Null : !k .Flags .Has (0 ),
},
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "Query" ,
SchemaName : "query" ,
},
{
Name : "PeerTypes" ,
SchemaName : "peer_types" ,
Null : !k .Flags .Has (1 ),
},
}
return typ
}
func (k *KeyboardButtonSwitchInline ) SetFlags () {
if !(k .SamePeer == false ) {
k .Flags .Set (0 )
}
if !(k .PeerTypes == nil ) {
k .Flags .Set (1 )
}
}
func (k *KeyboardButtonSwitchInline ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonSwitchInline#93b9fbb5 as nil" )
}
b .PutID (KeyboardButtonSwitchInlineTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonSwitchInline ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonSwitchInline#93b9fbb5 as nil" )
}
k .SetFlags ()
if err := k .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode keyboardButtonSwitchInline#93b9fbb5: field flags: %w" , err )
}
b .PutString (k .Text )
b .PutString (k .Query )
if k .Flags .Has (1 ) {
b .PutVectorHeader (len (k .PeerTypes ))
for idx , v := range k .PeerTypes {
if v == nil {
return fmt .Errorf ("unable to encode keyboardButtonSwitchInline#93b9fbb5: field peer_types element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode keyboardButtonSwitchInline#93b9fbb5: field peer_types element with index %d: %w" , idx , err )
}
}
}
return nil
}
func (k *KeyboardButtonSwitchInline ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonSwitchInline#93b9fbb5 to nil" )
}
if err := b .ConsumeID (KeyboardButtonSwitchInlineTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSwitchInline#93b9fbb5: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonSwitchInline ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonSwitchInline#93b9fbb5 to nil" )
}
{
if err := k .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSwitchInline#93b9fbb5: field flags: %w" , err )
}
}
k .SamePeer = k .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSwitchInline#93b9fbb5: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSwitchInline#93b9fbb5: field query: %w" , err )
}
k .Query = value
}
if k .Flags .Has (1 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSwitchInline#93b9fbb5: field peer_types: %w" , err )
}
if headerLen > 0 {
k .PeerTypes = make ([]InlineQueryPeerTypeClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeInlineQueryPeerType (b )
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSwitchInline#93b9fbb5: field peer_types: %w" , err )
}
k .PeerTypes = append (k .PeerTypes , value )
}
}
return nil
}
func (k *KeyboardButtonSwitchInline ) SetSamePeer (value bool ) {
if value {
k .Flags .Set (0 )
k .SamePeer = true
} else {
k .Flags .Unset (0 )
k .SamePeer = false
}
}
func (k *KeyboardButtonSwitchInline ) GetSamePeer () (value bool ) {
if k == nil {
return
}
return k .Flags .Has (0 )
}
func (k *KeyboardButtonSwitchInline ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonSwitchInline ) GetQuery () (value string ) {
if k == nil {
return
}
return k .Query
}
func (k *KeyboardButtonSwitchInline ) SetPeerTypes (value []InlineQueryPeerTypeClass ) {
k .Flags .Set (1 )
k .PeerTypes = value
}
func (k *KeyboardButtonSwitchInline ) GetPeerTypes () (value []InlineQueryPeerTypeClass , ok bool ) {
if k == nil {
return
}
if !k .Flags .Has (1 ) {
return value , false
}
return k .PeerTypes , true
}
func (k *KeyboardButtonSwitchInline ) MapPeerTypes () (value InlineQueryPeerTypeClassArray , ok bool ) {
if !k .Flags .Has (1 ) {
return value , false
}
return InlineQueryPeerTypeClassArray (k .PeerTypes ), true
}
type KeyboardButtonGame struct {
Text string
}
const KeyboardButtonGameTypeID = 0x50f41ccf
func (k KeyboardButtonGame ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonGame {}
_ bin .Decoder = &KeyboardButtonGame {}
_ bin .BareEncoder = &KeyboardButtonGame {}
_ bin .BareDecoder = &KeyboardButtonGame {}
_ KeyboardButtonClass = &KeyboardButtonGame {}
)
func (k *KeyboardButtonGame ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
return true
}
func (k *KeyboardButtonGame ) String () string {
if k == nil {
return "KeyboardButtonGame(nil)"
}
type Alias KeyboardButtonGame
return fmt .Sprintf ("KeyboardButtonGame%+v" , Alias (*k ))
}
func (k *KeyboardButtonGame ) FillFrom (from interface {
GetText () (value string )
}) {
k .Text = from .GetText ()
}
func (*KeyboardButtonGame ) TypeID () uint32 {
return KeyboardButtonGameTypeID
}
func (*KeyboardButtonGame ) TypeName () string {
return "keyboardButtonGame"
}
func (k *KeyboardButtonGame ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonGame" ,
ID : KeyboardButtonGameTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (k *KeyboardButtonGame ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonGame#50f41ccf as nil" )
}
b .PutID (KeyboardButtonGameTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonGame ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonGame#50f41ccf as nil" )
}
b .PutString (k .Text )
return nil
}
func (k *KeyboardButtonGame ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonGame#50f41ccf to nil" )
}
if err := b .ConsumeID (KeyboardButtonGameTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonGame#50f41ccf: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonGame ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonGame#50f41ccf to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonGame#50f41ccf: field text: %w" , err )
}
k .Text = value
}
return nil
}
func (k *KeyboardButtonGame ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
type KeyboardButtonBuy struct {
Text string
}
const KeyboardButtonBuyTypeID = 0xafd93fbb
func (k KeyboardButtonBuy ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonBuy {}
_ bin .Decoder = &KeyboardButtonBuy {}
_ bin .BareEncoder = &KeyboardButtonBuy {}
_ bin .BareDecoder = &KeyboardButtonBuy {}
_ KeyboardButtonClass = &KeyboardButtonBuy {}
)
func (k *KeyboardButtonBuy ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
return true
}
func (k *KeyboardButtonBuy ) String () string {
if k == nil {
return "KeyboardButtonBuy(nil)"
}
type Alias KeyboardButtonBuy
return fmt .Sprintf ("KeyboardButtonBuy%+v" , Alias (*k ))
}
func (k *KeyboardButtonBuy ) FillFrom (from interface {
GetText () (value string )
}) {
k .Text = from .GetText ()
}
func (*KeyboardButtonBuy ) TypeID () uint32 {
return KeyboardButtonBuyTypeID
}
func (*KeyboardButtonBuy ) TypeName () string {
return "keyboardButtonBuy"
}
func (k *KeyboardButtonBuy ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonBuy" ,
ID : KeyboardButtonBuyTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (k *KeyboardButtonBuy ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonBuy#afd93fbb as nil" )
}
b .PutID (KeyboardButtonBuyTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonBuy ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonBuy#afd93fbb as nil" )
}
b .PutString (k .Text )
return nil
}
func (k *KeyboardButtonBuy ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonBuy#afd93fbb to nil" )
}
if err := b .ConsumeID (KeyboardButtonBuyTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonBuy#afd93fbb: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonBuy ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonBuy#afd93fbb to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonBuy#afd93fbb: field text: %w" , err )
}
k .Text = value
}
return nil
}
func (k *KeyboardButtonBuy ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
type KeyboardButtonURLAuth struct {
Flags bin .Fields
Text string
FwdText string
URL string
ButtonID int
}
const KeyboardButtonURLAuthTypeID = 0x10b78d29
func (k KeyboardButtonURLAuth ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonURLAuth {}
_ bin .Decoder = &KeyboardButtonURLAuth {}
_ bin .BareEncoder = &KeyboardButtonURLAuth {}
_ bin .BareDecoder = &KeyboardButtonURLAuth {}
_ KeyboardButtonClass = &KeyboardButtonURLAuth {}
)
func (k *KeyboardButtonURLAuth ) Zero () bool {
if k == nil {
return true
}
if !(k .Flags .Zero ()) {
return false
}
if !(k .Text == "" ) {
return false
}
if !(k .FwdText == "" ) {
return false
}
if !(k .URL == "" ) {
return false
}
if !(k .ButtonID == 0 ) {
return false
}
return true
}
func (k *KeyboardButtonURLAuth ) String () string {
if k == nil {
return "KeyboardButtonURLAuth(nil)"
}
type Alias KeyboardButtonURLAuth
return fmt .Sprintf ("KeyboardButtonURLAuth%+v" , Alias (*k ))
}
func (k *KeyboardButtonURLAuth ) FillFrom (from interface {
GetText () (value string )
GetFwdText () (value string , ok bool )
GetURL () (value string )
GetButtonID () (value int )
}) {
k .Text = from .GetText ()
if val , ok := from .GetFwdText (); ok {
k .FwdText = val
}
k .URL = from .GetURL ()
k .ButtonID = from .GetButtonID ()
}
func (*KeyboardButtonURLAuth ) TypeID () uint32 {
return KeyboardButtonURLAuthTypeID
}
func (*KeyboardButtonURLAuth ) TypeName () string {
return "keyboardButtonUrlAuth"
}
func (k *KeyboardButtonURLAuth ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonUrlAuth" ,
ID : KeyboardButtonURLAuthTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "FwdText" ,
SchemaName : "fwd_text" ,
Null : !k .Flags .Has (0 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "ButtonID" ,
SchemaName : "button_id" ,
},
}
return typ
}
func (k *KeyboardButtonURLAuth ) SetFlags () {
if !(k .FwdText == "" ) {
k .Flags .Set (0 )
}
}
func (k *KeyboardButtonURLAuth ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonUrlAuth#10b78d29 as nil" )
}
b .PutID (KeyboardButtonURLAuthTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonURLAuth ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonUrlAuth#10b78d29 as nil" )
}
k .SetFlags ()
if err := k .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode keyboardButtonUrlAuth#10b78d29: field flags: %w" , err )
}
b .PutString (k .Text )
if k .Flags .Has (0 ) {
b .PutString (k .FwdText )
}
b .PutString (k .URL )
b .PutInt (k .ButtonID )
return nil
}
func (k *KeyboardButtonURLAuth ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonUrlAuth#10b78d29 to nil" )
}
if err := b .ConsumeID (KeyboardButtonURLAuthTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrlAuth#10b78d29: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonURLAuth ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonUrlAuth#10b78d29 to nil" )
}
{
if err := k .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrlAuth#10b78d29: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrlAuth#10b78d29: field text: %w" , err )
}
k .Text = value
}
if k .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrlAuth#10b78d29: field fwd_text: %w" , err )
}
k .FwdText = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrlAuth#10b78d29: field url: %w" , err )
}
k .URL = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUrlAuth#10b78d29: field button_id: %w" , err )
}
k .ButtonID = value
}
return nil
}
func (k *KeyboardButtonURLAuth ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonURLAuth ) SetFwdText (value string ) {
k .Flags .Set (0 )
k .FwdText = value
}
func (k *KeyboardButtonURLAuth ) GetFwdText () (value string , ok bool ) {
if k == nil {
return
}
if !k .Flags .Has (0 ) {
return value , false
}
return k .FwdText , true
}
func (k *KeyboardButtonURLAuth ) GetURL () (value string ) {
if k == nil {
return
}
return k .URL
}
func (k *KeyboardButtonURLAuth ) GetButtonID () (value int ) {
if k == nil {
return
}
return k .ButtonID
}
type InputKeyboardButtonURLAuth struct {
Flags bin .Fields
RequestWriteAccess bool
Text string
FwdText string
URL string
Bot InputUserClass
}
const InputKeyboardButtonURLAuthTypeID = 0xd02e7fd4
func (i InputKeyboardButtonURLAuth ) construct () KeyboardButtonClass { return &i }
var (
_ bin .Encoder = &InputKeyboardButtonURLAuth {}
_ bin .Decoder = &InputKeyboardButtonURLAuth {}
_ bin .BareEncoder = &InputKeyboardButtonURLAuth {}
_ bin .BareDecoder = &InputKeyboardButtonURLAuth {}
_ KeyboardButtonClass = &InputKeyboardButtonURLAuth {}
)
func (i *InputKeyboardButtonURLAuth ) Zero () bool {
if i == nil {
return true
}
if !(i .Flags .Zero ()) {
return false
}
if !(i .RequestWriteAccess == false ) {
return false
}
if !(i .Text == "" ) {
return false
}
if !(i .FwdText == "" ) {
return false
}
if !(i .URL == "" ) {
return false
}
if !(i .Bot == nil ) {
return false
}
return true
}
func (i *InputKeyboardButtonURLAuth ) String () string {
if i == nil {
return "InputKeyboardButtonURLAuth(nil)"
}
type Alias InputKeyboardButtonURLAuth
return fmt .Sprintf ("InputKeyboardButtonURLAuth%+v" , Alias (*i ))
}
func (i *InputKeyboardButtonURLAuth ) FillFrom (from interface {
GetRequestWriteAccess () (value bool )
GetText () (value string )
GetFwdText () (value string , ok bool )
GetURL () (value string )
GetBot () (value InputUserClass )
}) {
i .RequestWriteAccess = from .GetRequestWriteAccess ()
i .Text = from .GetText ()
if val , ok := from .GetFwdText (); ok {
i .FwdText = val
}
i .URL = from .GetURL ()
i .Bot = from .GetBot ()
}
func (*InputKeyboardButtonURLAuth ) TypeID () uint32 {
return InputKeyboardButtonURLAuthTypeID
}
func (*InputKeyboardButtonURLAuth ) TypeName () string {
return "inputKeyboardButtonUrlAuth"
}
func (i *InputKeyboardButtonURLAuth ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputKeyboardButtonUrlAuth" ,
ID : InputKeyboardButtonURLAuthTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "RequestWriteAccess" ,
SchemaName : "request_write_access" ,
Null : !i .Flags .Has (0 ),
},
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "FwdText" ,
SchemaName : "fwd_text" ,
Null : !i .Flags .Has (1 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "Bot" ,
SchemaName : "bot" ,
},
}
return typ
}
func (i *InputKeyboardButtonURLAuth ) SetFlags () {
if !(i .RequestWriteAccess == false ) {
i .Flags .Set (0 )
}
if !(i .FwdText == "" ) {
i .Flags .Set (1 )
}
}
func (i *InputKeyboardButtonURLAuth ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputKeyboardButtonUrlAuth#d02e7fd4 as nil" )
}
b .PutID (InputKeyboardButtonURLAuthTypeID )
return i .EncodeBare (b )
}
func (i *InputKeyboardButtonURLAuth ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputKeyboardButtonUrlAuth#d02e7fd4 as nil" )
}
i .SetFlags ()
if err := i .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field flags: %w" , err )
}
b .PutString (i .Text )
if i .Flags .Has (1 ) {
b .PutString (i .FwdText )
}
b .PutString (i .URL )
if i .Bot == nil {
return fmt .Errorf ("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field bot is nil" )
}
if err := i .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field bot: %w" , err )
}
return nil
}
func (i *InputKeyboardButtonURLAuth ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputKeyboardButtonUrlAuth#d02e7fd4 to nil" )
}
if err := b .ConsumeID (InputKeyboardButtonURLAuthTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputKeyboardButtonURLAuth ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputKeyboardButtonUrlAuth#d02e7fd4 to nil" )
}
{
if err := i .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field flags: %w" , err )
}
}
i .RequestWriteAccess = i .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field text: %w" , err )
}
i .Text = value
}
if i .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field fwd_text: %w" , err )
}
i .FwdText = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field url: %w" , err )
}
i .URL = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field bot: %w" , err )
}
i .Bot = value
}
return nil
}
func (i *InputKeyboardButtonURLAuth ) SetRequestWriteAccess (value bool ) {
if value {
i .Flags .Set (0 )
i .RequestWriteAccess = true
} else {
i .Flags .Unset (0 )
i .RequestWriteAccess = false
}
}
func (i *InputKeyboardButtonURLAuth ) GetRequestWriteAccess () (value bool ) {
if i == nil {
return
}
return i .Flags .Has (0 )
}
func (i *InputKeyboardButtonURLAuth ) GetText () (value string ) {
if i == nil {
return
}
return i .Text
}
func (i *InputKeyboardButtonURLAuth ) SetFwdText (value string ) {
i .Flags .Set (1 )
i .FwdText = value
}
func (i *InputKeyboardButtonURLAuth ) GetFwdText () (value string , ok bool ) {
if i == nil {
return
}
if !i .Flags .Has (1 ) {
return value , false
}
return i .FwdText , true
}
func (i *InputKeyboardButtonURLAuth ) GetURL () (value string ) {
if i == nil {
return
}
return i .URL
}
func (i *InputKeyboardButtonURLAuth ) GetBot () (value InputUserClass ) {
if i == nil {
return
}
return i .Bot
}
type KeyboardButtonRequestPoll struct {
Flags bin .Fields
Quiz bool
Text string
}
const KeyboardButtonRequestPollTypeID = 0xbbc7515d
func (k KeyboardButtonRequestPoll ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonRequestPoll {}
_ bin .Decoder = &KeyboardButtonRequestPoll {}
_ bin .BareEncoder = &KeyboardButtonRequestPoll {}
_ bin .BareDecoder = &KeyboardButtonRequestPoll {}
_ KeyboardButtonClass = &KeyboardButtonRequestPoll {}
)
func (k *KeyboardButtonRequestPoll ) Zero () bool {
if k == nil {
return true
}
if !(k .Flags .Zero ()) {
return false
}
if !(k .Quiz == false ) {
return false
}
if !(k .Text == "" ) {
return false
}
return true
}
func (k *KeyboardButtonRequestPoll ) String () string {
if k == nil {
return "KeyboardButtonRequestPoll(nil)"
}
type Alias KeyboardButtonRequestPoll
return fmt .Sprintf ("KeyboardButtonRequestPoll%+v" , Alias (*k ))
}
func (k *KeyboardButtonRequestPoll ) FillFrom (from interface {
GetQuiz () (value bool , ok bool )
GetText () (value string )
}) {
if val , ok := from .GetQuiz (); ok {
k .Quiz = val
}
k .Text = from .GetText ()
}
func (*KeyboardButtonRequestPoll ) TypeID () uint32 {
return KeyboardButtonRequestPollTypeID
}
func (*KeyboardButtonRequestPoll ) TypeName () string {
return "keyboardButtonRequestPoll"
}
func (k *KeyboardButtonRequestPoll ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonRequestPoll" ,
ID : KeyboardButtonRequestPollTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Quiz" ,
SchemaName : "quiz" ,
Null : !k .Flags .Has (0 ),
},
{
Name : "Text" ,
SchemaName : "text" ,
},
}
return typ
}
func (k *KeyboardButtonRequestPoll ) SetFlags () {
if !(k .Quiz == false ) {
k .Flags .Set (0 )
}
}
func (k *KeyboardButtonRequestPoll ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestPoll#bbc7515d as nil" )
}
b .PutID (KeyboardButtonRequestPollTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonRequestPoll ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestPoll#bbc7515d as nil" )
}
k .SetFlags ()
if err := k .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode keyboardButtonRequestPoll#bbc7515d: field flags: %w" , err )
}
if k .Flags .Has (0 ) {
b .PutBool (k .Quiz )
}
b .PutString (k .Text )
return nil
}
func (k *KeyboardButtonRequestPoll ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestPoll#bbc7515d to nil" )
}
if err := b .ConsumeID (KeyboardButtonRequestPollTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPoll#bbc7515d: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonRequestPoll ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestPoll#bbc7515d to nil" )
}
{
if err := k .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPoll#bbc7515d: field flags: %w" , err )
}
}
if k .Flags .Has (0 ) {
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPoll#bbc7515d: field quiz: %w" , err )
}
k .Quiz = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPoll#bbc7515d: field text: %w" , err )
}
k .Text = value
}
return nil
}
func (k *KeyboardButtonRequestPoll ) SetQuiz (value bool ) {
k .Flags .Set (0 )
k .Quiz = value
}
func (k *KeyboardButtonRequestPoll ) GetQuiz () (value bool , ok bool ) {
if k == nil {
return
}
if !k .Flags .Has (0 ) {
return value , false
}
return k .Quiz , true
}
func (k *KeyboardButtonRequestPoll ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
type InputKeyboardButtonUserProfile struct {
Text string
UserID InputUserClass
}
const InputKeyboardButtonUserProfileTypeID = 0xe988037b
func (i InputKeyboardButtonUserProfile ) construct () KeyboardButtonClass { return &i }
var (
_ bin .Encoder = &InputKeyboardButtonUserProfile {}
_ bin .Decoder = &InputKeyboardButtonUserProfile {}
_ bin .BareEncoder = &InputKeyboardButtonUserProfile {}
_ bin .BareDecoder = &InputKeyboardButtonUserProfile {}
_ KeyboardButtonClass = &InputKeyboardButtonUserProfile {}
)
func (i *InputKeyboardButtonUserProfile ) Zero () bool {
if i == nil {
return true
}
if !(i .Text == "" ) {
return false
}
if !(i .UserID == nil ) {
return false
}
return true
}
func (i *InputKeyboardButtonUserProfile ) String () string {
if i == nil {
return "InputKeyboardButtonUserProfile(nil)"
}
type Alias InputKeyboardButtonUserProfile
return fmt .Sprintf ("InputKeyboardButtonUserProfile%+v" , Alias (*i ))
}
func (i *InputKeyboardButtonUserProfile ) FillFrom (from interface {
GetText () (value string )
GetUserID () (value InputUserClass )
}) {
i .Text = from .GetText ()
i .UserID = from .GetUserID ()
}
func (*InputKeyboardButtonUserProfile ) TypeID () uint32 {
return InputKeyboardButtonUserProfileTypeID
}
func (*InputKeyboardButtonUserProfile ) TypeName () string {
return "inputKeyboardButtonUserProfile"
}
func (i *InputKeyboardButtonUserProfile ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputKeyboardButtonUserProfile" ,
ID : InputKeyboardButtonUserProfileTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (i *InputKeyboardButtonUserProfile ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputKeyboardButtonUserProfile#e988037b as nil" )
}
b .PutID (InputKeyboardButtonUserProfileTypeID )
return i .EncodeBare (b )
}
func (i *InputKeyboardButtonUserProfile ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputKeyboardButtonUserProfile#e988037b as nil" )
}
b .PutString (i .Text )
if i .UserID == nil {
return fmt .Errorf ("unable to encode inputKeyboardButtonUserProfile#e988037b: field user_id is nil" )
}
if err := i .UserID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputKeyboardButtonUserProfile#e988037b: field user_id: %w" , err )
}
return nil
}
func (i *InputKeyboardButtonUserProfile ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputKeyboardButtonUserProfile#e988037b to nil" )
}
if err := b .ConsumeID (InputKeyboardButtonUserProfileTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUserProfile#e988037b: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputKeyboardButtonUserProfile ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputKeyboardButtonUserProfile#e988037b to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUserProfile#e988037b: field text: %w" , err )
}
i .Text = value
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode inputKeyboardButtonUserProfile#e988037b: field user_id: %w" , err )
}
i .UserID = value
}
return nil
}
func (i *InputKeyboardButtonUserProfile ) GetText () (value string ) {
if i == nil {
return
}
return i .Text
}
func (i *InputKeyboardButtonUserProfile ) GetUserID () (value InputUserClass ) {
if i == nil {
return
}
return i .UserID
}
type KeyboardButtonUserProfile struct {
Text string
UserID int64
}
const KeyboardButtonUserProfileTypeID = 0x308660c1
func (k KeyboardButtonUserProfile ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonUserProfile {}
_ bin .Decoder = &KeyboardButtonUserProfile {}
_ bin .BareEncoder = &KeyboardButtonUserProfile {}
_ bin .BareDecoder = &KeyboardButtonUserProfile {}
_ KeyboardButtonClass = &KeyboardButtonUserProfile {}
)
func (k *KeyboardButtonUserProfile ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
if !(k .UserID == 0 ) {
return false
}
return true
}
func (k *KeyboardButtonUserProfile ) String () string {
if k == nil {
return "KeyboardButtonUserProfile(nil)"
}
type Alias KeyboardButtonUserProfile
return fmt .Sprintf ("KeyboardButtonUserProfile%+v" , Alias (*k ))
}
func (k *KeyboardButtonUserProfile ) FillFrom (from interface {
GetText () (value string )
GetUserID () (value int64 )
}) {
k .Text = from .GetText ()
k .UserID = from .GetUserID ()
}
func (*KeyboardButtonUserProfile ) TypeID () uint32 {
return KeyboardButtonUserProfileTypeID
}
func (*KeyboardButtonUserProfile ) TypeName () string {
return "keyboardButtonUserProfile"
}
func (k *KeyboardButtonUserProfile ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonUserProfile" ,
ID : KeyboardButtonUserProfileTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (k *KeyboardButtonUserProfile ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonUserProfile#308660c1 as nil" )
}
b .PutID (KeyboardButtonUserProfileTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonUserProfile ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonUserProfile#308660c1 as nil" )
}
b .PutString (k .Text )
b .PutLong (k .UserID )
return nil
}
func (k *KeyboardButtonUserProfile ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonUserProfile#308660c1 to nil" )
}
if err := b .ConsumeID (KeyboardButtonUserProfileTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUserProfile#308660c1: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonUserProfile ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonUserProfile#308660c1 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUserProfile#308660c1: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonUserProfile#308660c1: field user_id: %w" , err )
}
k .UserID = value
}
return nil
}
func (k *KeyboardButtonUserProfile ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonUserProfile ) GetUserID () (value int64 ) {
if k == nil {
return
}
return k .UserID
}
type KeyboardButtonWebView struct {
Text string
URL string
}
const KeyboardButtonWebViewTypeID = 0x13767230
func (k KeyboardButtonWebView ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonWebView {}
_ bin .Decoder = &KeyboardButtonWebView {}
_ bin .BareEncoder = &KeyboardButtonWebView {}
_ bin .BareDecoder = &KeyboardButtonWebView {}
_ KeyboardButtonClass = &KeyboardButtonWebView {}
)
func (k *KeyboardButtonWebView ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
if !(k .URL == "" ) {
return false
}
return true
}
func (k *KeyboardButtonWebView ) String () string {
if k == nil {
return "KeyboardButtonWebView(nil)"
}
type Alias KeyboardButtonWebView
return fmt .Sprintf ("KeyboardButtonWebView%+v" , Alias (*k ))
}
func (k *KeyboardButtonWebView ) FillFrom (from interface {
GetText () (value string )
GetURL () (value string )
}) {
k .Text = from .GetText ()
k .URL = from .GetURL ()
}
func (*KeyboardButtonWebView ) TypeID () uint32 {
return KeyboardButtonWebViewTypeID
}
func (*KeyboardButtonWebView ) TypeName () string {
return "keyboardButtonWebView"
}
func (k *KeyboardButtonWebView ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonWebView" ,
ID : KeyboardButtonWebViewTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (k *KeyboardButtonWebView ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonWebView#13767230 as nil" )
}
b .PutID (KeyboardButtonWebViewTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonWebView ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonWebView#13767230 as nil" )
}
b .PutString (k .Text )
b .PutString (k .URL )
return nil
}
func (k *KeyboardButtonWebView ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonWebView#13767230 to nil" )
}
if err := b .ConsumeID (KeyboardButtonWebViewTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonWebView#13767230: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonWebView ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonWebView#13767230 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonWebView#13767230: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonWebView#13767230: field url: %w" , err )
}
k .URL = value
}
return nil
}
func (k *KeyboardButtonWebView ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonWebView ) GetURL () (value string ) {
if k == nil {
return
}
return k .URL
}
type KeyboardButtonSimpleWebView struct {
Text string
URL string
}
const KeyboardButtonSimpleWebViewTypeID = 0xa0c0505c
func (k KeyboardButtonSimpleWebView ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonSimpleWebView {}
_ bin .Decoder = &KeyboardButtonSimpleWebView {}
_ bin .BareEncoder = &KeyboardButtonSimpleWebView {}
_ bin .BareDecoder = &KeyboardButtonSimpleWebView {}
_ KeyboardButtonClass = &KeyboardButtonSimpleWebView {}
)
func (k *KeyboardButtonSimpleWebView ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
if !(k .URL == "" ) {
return false
}
return true
}
func (k *KeyboardButtonSimpleWebView ) String () string {
if k == nil {
return "KeyboardButtonSimpleWebView(nil)"
}
type Alias KeyboardButtonSimpleWebView
return fmt .Sprintf ("KeyboardButtonSimpleWebView%+v" , Alias (*k ))
}
func (k *KeyboardButtonSimpleWebView ) FillFrom (from interface {
GetText () (value string )
GetURL () (value string )
}) {
k .Text = from .GetText ()
k .URL = from .GetURL ()
}
func (*KeyboardButtonSimpleWebView ) TypeID () uint32 {
return KeyboardButtonSimpleWebViewTypeID
}
func (*KeyboardButtonSimpleWebView ) TypeName () string {
return "keyboardButtonSimpleWebView"
}
func (k *KeyboardButtonSimpleWebView ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonSimpleWebView" ,
ID : KeyboardButtonSimpleWebViewTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (k *KeyboardButtonSimpleWebView ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonSimpleWebView#a0c0505c as nil" )
}
b .PutID (KeyboardButtonSimpleWebViewTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonSimpleWebView ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonSimpleWebView#a0c0505c as nil" )
}
b .PutString (k .Text )
b .PutString (k .URL )
return nil
}
func (k *KeyboardButtonSimpleWebView ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonSimpleWebView#a0c0505c to nil" )
}
if err := b .ConsumeID (KeyboardButtonSimpleWebViewTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSimpleWebView#a0c0505c: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonSimpleWebView ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonSimpleWebView#a0c0505c to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSimpleWebView#a0c0505c: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonSimpleWebView#a0c0505c: field url: %w" , err )
}
k .URL = value
}
return nil
}
func (k *KeyboardButtonSimpleWebView ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonSimpleWebView ) GetURL () (value string ) {
if k == nil {
return
}
return k .URL
}
type KeyboardButtonRequestPeer struct {
Text string
ButtonID int
PeerType RequestPeerTypeClass
MaxQuantity int
}
const KeyboardButtonRequestPeerTypeID = 0x53d7bfd8
func (k KeyboardButtonRequestPeer ) construct () KeyboardButtonClass { return &k }
var (
_ bin .Encoder = &KeyboardButtonRequestPeer {}
_ bin .Decoder = &KeyboardButtonRequestPeer {}
_ bin .BareEncoder = &KeyboardButtonRequestPeer {}
_ bin .BareDecoder = &KeyboardButtonRequestPeer {}
_ KeyboardButtonClass = &KeyboardButtonRequestPeer {}
)
func (k *KeyboardButtonRequestPeer ) Zero () bool {
if k == nil {
return true
}
if !(k .Text == "" ) {
return false
}
if !(k .ButtonID == 0 ) {
return false
}
if !(k .PeerType == nil ) {
return false
}
if !(k .MaxQuantity == 0 ) {
return false
}
return true
}
func (k *KeyboardButtonRequestPeer ) String () string {
if k == nil {
return "KeyboardButtonRequestPeer(nil)"
}
type Alias KeyboardButtonRequestPeer
return fmt .Sprintf ("KeyboardButtonRequestPeer%+v" , Alias (*k ))
}
func (k *KeyboardButtonRequestPeer ) FillFrom (from interface {
GetText () (value string )
GetButtonID () (value int )
GetPeerType () (value RequestPeerTypeClass )
GetMaxQuantity () (value int )
}) {
k .Text = from .GetText ()
k .ButtonID = from .GetButtonID ()
k .PeerType = from .GetPeerType ()
k .MaxQuantity = from .GetMaxQuantity ()
}
func (*KeyboardButtonRequestPeer ) TypeID () uint32 {
return KeyboardButtonRequestPeerTypeID
}
func (*KeyboardButtonRequestPeer ) TypeName () string {
return "keyboardButtonRequestPeer"
}
func (k *KeyboardButtonRequestPeer ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "keyboardButtonRequestPeer" ,
ID : KeyboardButtonRequestPeerTypeID ,
}
if k == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Text" ,
SchemaName : "text" ,
},
{
Name : "ButtonID" ,
SchemaName : "button_id" ,
},
{
Name : "PeerType" ,
SchemaName : "peer_type" ,
},
{
Name : "MaxQuantity" ,
SchemaName : "max_quantity" ,
},
}
return typ
}
func (k *KeyboardButtonRequestPeer ) Encode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil" )
}
b .PutID (KeyboardButtonRequestPeerTypeID )
return k .EncodeBare (b )
}
func (k *KeyboardButtonRequestPeer ) EncodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil" )
}
b .PutString (k .Text )
b .PutInt (k .ButtonID )
if k .PeerType == nil {
return fmt .Errorf ("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type is nil" )
}
if err := k .PeerType .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w" , err )
}
b .PutInt (k .MaxQuantity )
return nil
}
func (k *KeyboardButtonRequestPeer ) Decode (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil" )
}
if err := b .ConsumeID (KeyboardButtonRequestPeerTypeID ); err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPeer#53d7bfd8: %w" , err )
}
return k .DecodeBare (b )
}
func (k *KeyboardButtonRequestPeer ) DecodeBare (b *bin .Buffer ) error {
if k == nil {
return fmt .Errorf ("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPeer#53d7bfd8: field text: %w" , err )
}
k .Text = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPeer#53d7bfd8: field button_id: %w" , err )
}
k .ButtonID = value
}
{
value , err := DecodeRequestPeerType (b )
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w" , err )
}
k .PeerType = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode keyboardButtonRequestPeer#53d7bfd8: field max_quantity: %w" , err )
}
k .MaxQuantity = value
}
return nil
}
func (k *KeyboardButtonRequestPeer ) GetText () (value string ) {
if k == nil {
return
}
return k .Text
}
func (k *KeyboardButtonRequestPeer ) GetButtonID () (value int ) {
if k == nil {
return
}
return k .ButtonID
}
func (k *KeyboardButtonRequestPeer ) GetPeerType () (value RequestPeerTypeClass ) {
if k == nil {
return
}
return k .PeerType
}
func (k *KeyboardButtonRequestPeer ) GetMaxQuantity () (value int ) {
if k == nil {
return
}
return k .MaxQuantity
}
const KeyboardButtonClassName = "KeyboardButton"
type KeyboardButtonClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () KeyboardButtonClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetText () (value string )
}
func DecodeKeyboardButton (buf *bin .Buffer ) (KeyboardButtonClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case KeyboardButtonTypeID :
v := KeyboardButton {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonURLTypeID :
v := KeyboardButtonURL {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonCallbackTypeID :
v := KeyboardButtonCallback {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonRequestPhoneTypeID :
v := KeyboardButtonRequestPhone {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonRequestGeoLocationTypeID :
v := KeyboardButtonRequestGeoLocation {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonSwitchInlineTypeID :
v := KeyboardButtonSwitchInline {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonGameTypeID :
v := KeyboardButtonGame {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonBuyTypeID :
v := KeyboardButtonBuy {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonURLAuthTypeID :
v := KeyboardButtonURLAuth {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case InputKeyboardButtonURLAuthTypeID :
v := InputKeyboardButtonURLAuth {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonRequestPollTypeID :
v := KeyboardButtonRequestPoll {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case InputKeyboardButtonUserProfileTypeID :
v := InputKeyboardButtonUserProfile {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonUserProfileTypeID :
v := KeyboardButtonUserProfile {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonWebViewTypeID :
v := KeyboardButtonWebView {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonSimpleWebViewTypeID :
v := KeyboardButtonSimpleWebView {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
case KeyboardButtonRequestPeerTypeID :
v := KeyboardButtonRequestPeer {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode KeyboardButtonClass: %w" , bin .NewUnexpectedID (id ))
}
}
type KeyboardButtonBox struct {
KeyboardButton KeyboardButtonClass
}
func (b *KeyboardButtonBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode KeyboardButtonBox to nil" )
}
v , err := DecodeKeyboardButton (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .KeyboardButton = v
return nil
}
func (b *KeyboardButtonBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .KeyboardButton == nil {
return fmt .Errorf ("unable to encode KeyboardButtonClass as nil" )
}
return b .KeyboardButton .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .