// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// 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{}
)

// KeyboardButton represents TL type `keyboardButton#a2fa4880`.
// Bot keyboard button
//
// See https://core.telegram.org/constructor/keyboardButton for reference.
type KeyboardButton struct {
	// Button text
	Text string
}

// KeyboardButtonTypeID is TL type id of KeyboardButton.
const KeyboardButtonTypeID = 0xa2fa4880

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButton) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButton.
var (
	_ bin.Encoder     = &KeyboardButton{}
	_ bin.Decoder     = &KeyboardButton{}
	_ bin.BareEncoder = &KeyboardButton{}
	_ bin.BareDecoder = &KeyboardButton{}

	_ KeyboardButtonClass = &KeyboardButton{}
)

func ( *KeyboardButton) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButton) () string {
	if  == nil {
		return "KeyboardButton(nil)"
	}
	type  KeyboardButton
	return fmt.Sprintf("KeyboardButton%+v", (*))
}

// FillFrom fills KeyboardButton from given interface.
func ( *KeyboardButton) ( interface {
	() ( string)
}) {
	.Text = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButton) () uint32 {
	return KeyboardButtonTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButton) () string {
	return "keyboardButton"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButton) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButton",
		ID:   KeyboardButtonTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButton#a2fa4880 as nil")
	}
	.PutID(KeyboardButtonTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButton#a2fa4880 as nil")
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButton#a2fa4880 to nil")
	}
	if  := .ConsumeID(KeyboardButtonTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButton#a2fa4880: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButton) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButton#a2fa4880 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButton#a2fa4880: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButton) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonURL represents TL type `keyboardButtonUrl#258aff05`.
// URL button
//
// See https://core.telegram.org/constructor/keyboardButtonUrl for reference.
type KeyboardButtonURL struct {
	// Button label
	Text string
	// URL
	URL string
}

// KeyboardButtonURLTypeID is TL type id of KeyboardButtonURL.
const KeyboardButtonURLTypeID = 0x258aff05

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonURL) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonURL.
var (
	_ bin.Encoder     = &KeyboardButtonURL{}
	_ bin.Decoder     = &KeyboardButtonURL{}
	_ bin.BareEncoder = &KeyboardButtonURL{}
	_ bin.BareDecoder = &KeyboardButtonURL{}

	_ KeyboardButtonClass = &KeyboardButtonURL{}
)

func ( *KeyboardButtonURL) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonURL) () string {
	if  == nil {
		return "KeyboardButtonURL(nil)"
	}
	type  KeyboardButtonURL
	return fmt.Sprintf("KeyboardButtonURL%+v", (*))
}

// FillFrom fills KeyboardButtonURL from given interface.
func ( *KeyboardButtonURL) ( interface {
	() ( string)
	() ( string)
}) {
	.Text = .()
	.URL = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonURL) () uint32 {
	return KeyboardButtonURLTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonURL) () string {
	return "keyboardButtonUrl"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonURL) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonUrl",
		ID:   KeyboardButtonURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrl#258aff05 as nil")
	}
	.PutID(KeyboardButtonURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrl#258aff05 as nil")
	}
	.PutString(.Text)
	.PutString(.URL)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUrl#258aff05 to nil")
	}
	if  := .ConsumeID(KeyboardButtonURLTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonUrl#258aff05: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUrl#258aff05 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrl#258aff05: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrl#258aff05: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonURL) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetURL returns value of URL field.
func ( *KeyboardButtonURL) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// KeyboardButtonCallback represents TL type `keyboardButtonCallback#35bbdb6b`.
// Callback button
//
// See https://core.telegram.org/constructor/keyboardButtonCallback for reference.
type KeyboardButtonCallback struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the user should verify his identity by entering his 2FA SRP parameters¹ to
	// the messages.getBotCallbackAnswer² method. NOTE: telegram and the bot WILL NOT have
	// access to the plaintext password, thanks to SRP³. This button is mainly used by the
	// official @botfather⁴ bot, for verifying the user's identity before transferring
	// ownership of a bot to another user.
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	//  2) https://core.telegram.org/method/messages.getBotCallbackAnswer
	//  3) https://core.telegram.org/api/srp
	//  4) https://t.me/botfather
	RequiresPassword bool
	// Button text
	Text string
	// Callback data
	Data []byte
}

// KeyboardButtonCallbackTypeID is TL type id of KeyboardButtonCallback.
const KeyboardButtonCallbackTypeID = 0x35bbdb6b

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonCallback) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonCallback.
var (
	_ bin.Encoder     = &KeyboardButtonCallback{}
	_ bin.Decoder     = &KeyboardButtonCallback{}
	_ bin.BareEncoder = &KeyboardButtonCallback{}
	_ bin.BareDecoder = &KeyboardButtonCallback{}

	_ KeyboardButtonClass = &KeyboardButtonCallback{}
)

func ( *KeyboardButtonCallback) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.RequiresPassword == false) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.Data == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonCallback) () string {
	if  == nil {
		return "KeyboardButtonCallback(nil)"
	}
	type  KeyboardButtonCallback
	return fmt.Sprintf("KeyboardButtonCallback%+v", (*))
}

// FillFrom fills KeyboardButtonCallback from given interface.
func ( *KeyboardButtonCallback) ( interface {
	() ( bool)
	() ( string)
	() ( []byte)
}) {
	.RequiresPassword = .()
	.Text = .()
	.Data = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonCallback) () uint32 {
	return KeyboardButtonCallbackTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonCallback) () string {
	return "keyboardButtonCallback"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonCallback) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonCallback",
		ID:   KeyboardButtonCallbackTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "RequiresPassword",
			SchemaName: "requires_password",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Data",
			SchemaName: "data",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonCallback) () {
	if !(.RequiresPassword == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonCallback#35bbdb6b as nil")
	}
	.PutID(KeyboardButtonCallbackTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonCallback#35bbdb6b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonCallback#35bbdb6b: field flags: %w", )
	}
	.PutString(.Text)
	.PutBytes(.Data)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonCallback#35bbdb6b to nil")
	}
	if  := .ConsumeID(KeyboardButtonCallbackTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonCallback) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonCallback#35bbdb6b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: field flags: %w", )
		}
	}
	.RequiresPassword = .Flags.Has(0)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonCallback#35bbdb6b: field data: %w", )
		}
		.Data = 
	}
	return nil
}

// SetRequiresPassword sets value of RequiresPassword conditional field.
func ( *KeyboardButtonCallback) ( bool) {
	if  {
		.Flags.Set(0)
		.RequiresPassword = true
	} else {
		.Flags.Unset(0)
		.RequiresPassword = false
	}
}

// GetRequiresPassword returns value of RequiresPassword conditional field.
func ( *KeyboardButtonCallback) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetText returns value of Text field.
func ( *KeyboardButtonCallback) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetData returns value of Data field.
func ( *KeyboardButtonCallback) () ( []byte) {
	if  == nil {
		return
	}
	return .Data
}

// KeyboardButtonRequestPhone represents TL type `keyboardButtonRequestPhone#b16a6c29`.
// Button to request a user's phone number
//
// See https://core.telegram.org/constructor/keyboardButtonRequestPhone for reference.
type KeyboardButtonRequestPhone struct {
	// Button text
	Text string
}

// KeyboardButtonRequestPhoneTypeID is TL type id of KeyboardButtonRequestPhone.
const KeyboardButtonRequestPhoneTypeID = 0xb16a6c29

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestPhone) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonRequestPhone.
var (
	_ bin.Encoder     = &KeyboardButtonRequestPhone{}
	_ bin.Decoder     = &KeyboardButtonRequestPhone{}
	_ bin.BareEncoder = &KeyboardButtonRequestPhone{}
	_ bin.BareDecoder = &KeyboardButtonRequestPhone{}

	_ KeyboardButtonClass = &KeyboardButtonRequestPhone{}
)

func ( *KeyboardButtonRequestPhone) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonRequestPhone) () string {
	if  == nil {
		return "KeyboardButtonRequestPhone(nil)"
	}
	type  KeyboardButtonRequestPhone
	return fmt.Sprintf("KeyboardButtonRequestPhone%+v", (*))
}

// FillFrom fills KeyboardButtonRequestPhone from given interface.
func ( *KeyboardButtonRequestPhone) ( interface {
	() ( string)
}) {
	.Text = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonRequestPhone) () uint32 {
	return KeyboardButtonRequestPhoneTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonRequestPhone) () string {
	return "keyboardButtonRequestPhone"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestPhone) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestPhone",
		ID:   KeyboardButtonRequestPhoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPhone#b16a6c29 as nil")
	}
	.PutID(KeyboardButtonRequestPhoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPhone#b16a6c29 as nil")
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPhone#b16a6c29 to nil")
	}
	if  := .ConsumeID(KeyboardButtonRequestPhoneTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonRequestPhone#b16a6c29: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPhone#b16a6c29 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPhone#b16a6c29: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestPhone) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonRequestGeoLocation represents TL type `keyboardButtonRequestGeoLocation#fc796b3f`.
// Button to request a user's geolocation
//
// See https://core.telegram.org/constructor/keyboardButtonRequestGeoLocation for reference.
type KeyboardButtonRequestGeoLocation struct {
	// Button text
	Text string
}

// KeyboardButtonRequestGeoLocationTypeID is TL type id of KeyboardButtonRequestGeoLocation.
const KeyboardButtonRequestGeoLocationTypeID = 0xfc796b3f

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestGeoLocation) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonRequestGeoLocation.
var (
	_ bin.Encoder     = &KeyboardButtonRequestGeoLocation{}
	_ bin.Decoder     = &KeyboardButtonRequestGeoLocation{}
	_ bin.BareEncoder = &KeyboardButtonRequestGeoLocation{}
	_ bin.BareDecoder = &KeyboardButtonRequestGeoLocation{}

	_ KeyboardButtonClass = &KeyboardButtonRequestGeoLocation{}
)

func ( *KeyboardButtonRequestGeoLocation) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonRequestGeoLocation) () string {
	if  == nil {
		return "KeyboardButtonRequestGeoLocation(nil)"
	}
	type  KeyboardButtonRequestGeoLocation
	return fmt.Sprintf("KeyboardButtonRequestGeoLocation%+v", (*))
}

// FillFrom fills KeyboardButtonRequestGeoLocation from given interface.
func ( *KeyboardButtonRequestGeoLocation) ( interface {
	() ( string)
}) {
	.Text = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonRequestGeoLocation) () uint32 {
	return KeyboardButtonRequestGeoLocationTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonRequestGeoLocation) () string {
	return "keyboardButtonRequestGeoLocation"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestGeoLocation) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestGeoLocation",
		ID:   KeyboardButtonRequestGeoLocationTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#fc796b3f as nil")
	}
	.PutID(KeyboardButtonRequestGeoLocationTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestGeoLocation#fc796b3f as nil")
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#fc796b3f to nil")
	}
	if  := .ConsumeID(KeyboardButtonRequestGeoLocationTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#fc796b3f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestGeoLocation) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestGeoLocation#fc796b3f to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestGeoLocation#fc796b3f: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestGeoLocation) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonSwitchInline represents TL type `keyboardButtonSwitchInline#93b9fbb5`.
// Button to force a user to switch to inline mode: pressing the button will prompt the
// user to select one of their chats, open that chat and insert the bot's username and
// the specified inline query in the input field.
//
// See https://core.telegram.org/constructor/keyboardButtonSwitchInline for reference.
type KeyboardButtonSwitchInline struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, pressing the button will insert the bot's username and the specified inline
	// query in the current chat's input field.
	SamePeer bool
	// Button label
	Text string
	// The inline query to use
	Query string
	// Filter to use when selecting chats.
	//
	// Use SetPeerTypes and GetPeerTypes helpers.
	PeerTypes []InlineQueryPeerTypeClass
}

// KeyboardButtonSwitchInlineTypeID is TL type id of KeyboardButtonSwitchInline.
const KeyboardButtonSwitchInlineTypeID = 0x93b9fbb5

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonSwitchInline) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonSwitchInline.
var (
	_ bin.Encoder     = &KeyboardButtonSwitchInline{}
	_ bin.Decoder     = &KeyboardButtonSwitchInline{}
	_ bin.BareEncoder = &KeyboardButtonSwitchInline{}
	_ bin.BareDecoder = &KeyboardButtonSwitchInline{}

	_ KeyboardButtonClass = &KeyboardButtonSwitchInline{}
)

func ( *KeyboardButtonSwitchInline) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.SamePeer == false) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.Query == "") {
		return false
	}
	if !(.PeerTypes == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonSwitchInline) () string {
	if  == nil {
		return "KeyboardButtonSwitchInline(nil)"
	}
	type  KeyboardButtonSwitchInline
	return fmt.Sprintf("KeyboardButtonSwitchInline%+v", (*))
}

// FillFrom fills KeyboardButtonSwitchInline from given interface.
func ( *KeyboardButtonSwitchInline) ( interface {
	() ( bool)
	() ( string)
	() ( string)
	() ( []InlineQueryPeerTypeClass,  bool)
}) {
	.SamePeer = .()
	.Text = .()
	.Query = .()
	if ,  := .();  {
		.PeerTypes = 
	}

}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonSwitchInline) () uint32 {
	return KeyboardButtonSwitchInlineTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonSwitchInline) () string {
	return "keyboardButtonSwitchInline"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonSwitchInline) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonSwitchInline",
		ID:   KeyboardButtonSwitchInlineTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "SamePeer",
			SchemaName: "same_peer",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
		{
			Name:       "PeerTypes",
			SchemaName: "peer_types",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonSwitchInline) () {
	if !(.SamePeer == false) {
		.Flags.Set(0)
	}
	if !(.PeerTypes == nil) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSwitchInline#93b9fbb5 as nil")
	}
	.PutID(KeyboardButtonSwitchInlineTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSwitchInline#93b9fbb5 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonSwitchInline#93b9fbb5: field flags: %w", )
	}
	.PutString(.Text)
	.PutString(.Query)
	if .Flags.Has(1) {
		.PutVectorHeader(len(.PeerTypes))
		for ,  := range .PeerTypes {
			if  == nil {
				return fmt.Errorf("unable to encode keyboardButtonSwitchInline#93b9fbb5: field peer_types element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode keyboardButtonSwitchInline#93b9fbb5: field peer_types element with index %d: %w", , )
			}
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonSwitchInline#93b9fbb5 to nil")
	}
	if  := .ConsumeID(KeyboardButtonSwitchInlineTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonSwitchInline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonSwitchInline#93b9fbb5 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field flags: %w", )
		}
	}
	.SamePeer = .Flags.Has(0)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field query: %w", )
		}
		.Query = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field peer_types: %w", )
		}

		if  > 0 {
			.PeerTypes = make([]InlineQueryPeerTypeClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInlineQueryPeerType()
			if  != nil {
				return fmt.Errorf("unable to decode keyboardButtonSwitchInline#93b9fbb5: field peer_types: %w", )
			}
			.PeerTypes = append(.PeerTypes, )
		}
	}
	return nil
}

// SetSamePeer sets value of SamePeer conditional field.
func ( *KeyboardButtonSwitchInline) ( bool) {
	if  {
		.Flags.Set(0)
		.SamePeer = true
	} else {
		.Flags.Unset(0)
		.SamePeer = false
	}
}

// GetSamePeer returns value of SamePeer conditional field.
func ( *KeyboardButtonSwitchInline) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetText returns value of Text field.
func ( *KeyboardButtonSwitchInline) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetQuery returns value of Query field.
func ( *KeyboardButtonSwitchInline) () ( string) {
	if  == nil {
		return
	}
	return .Query
}

// SetPeerTypes sets value of PeerTypes conditional field.
func ( *KeyboardButtonSwitchInline) ( []InlineQueryPeerTypeClass) {
	.Flags.Set(1)
	.PeerTypes = 
}

// GetPeerTypes returns value of PeerTypes conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonSwitchInline) () ( []InlineQueryPeerTypeClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .PeerTypes, true
}

// MapPeerTypes returns field PeerTypes wrapped in InlineQueryPeerTypeClassArray helper.
func ( *KeyboardButtonSwitchInline) () ( InlineQueryPeerTypeClassArray,  bool) {
	if !.Flags.Has(1) {
		return , false
	}
	return InlineQueryPeerTypeClassArray(.PeerTypes), true
}

// KeyboardButtonGame represents TL type `keyboardButtonGame#50f41ccf`.
// Button to start a game
//
// See https://core.telegram.org/constructor/keyboardButtonGame for reference.
type KeyboardButtonGame struct {
	// Button text
	Text string
}

// KeyboardButtonGameTypeID is TL type id of KeyboardButtonGame.
const KeyboardButtonGameTypeID = 0x50f41ccf

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonGame) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonGame.
var (
	_ bin.Encoder     = &KeyboardButtonGame{}
	_ bin.Decoder     = &KeyboardButtonGame{}
	_ bin.BareEncoder = &KeyboardButtonGame{}
	_ bin.BareDecoder = &KeyboardButtonGame{}

	_ KeyboardButtonClass = &KeyboardButtonGame{}
)

func ( *KeyboardButtonGame) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonGame) () string {
	if  == nil {
		return "KeyboardButtonGame(nil)"
	}
	type  KeyboardButtonGame
	return fmt.Sprintf("KeyboardButtonGame%+v", (*))
}

// FillFrom fills KeyboardButtonGame from given interface.
func ( *KeyboardButtonGame) ( interface {
	() ( string)
}) {
	.Text = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonGame) () uint32 {
	return KeyboardButtonGameTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonGame) () string {
	return "keyboardButtonGame"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonGame) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonGame",
		ID:   KeyboardButtonGameTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonGame#50f41ccf as nil")
	}
	.PutID(KeyboardButtonGameTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonGame#50f41ccf as nil")
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonGame#50f41ccf to nil")
	}
	if  := .ConsumeID(KeyboardButtonGameTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonGame#50f41ccf: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonGame#50f41ccf to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonGame#50f41ccf: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonGame) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonBuy represents TL type `keyboardButtonBuy#afd93fbb`.
// Button to buy a product
//
// See https://core.telegram.org/constructor/keyboardButtonBuy for reference.
type KeyboardButtonBuy struct {
	// Button text
	Text string
}

// KeyboardButtonBuyTypeID is TL type id of KeyboardButtonBuy.
const KeyboardButtonBuyTypeID = 0xafd93fbb

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonBuy) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonBuy.
var (
	_ bin.Encoder     = &KeyboardButtonBuy{}
	_ bin.Decoder     = &KeyboardButtonBuy{}
	_ bin.BareEncoder = &KeyboardButtonBuy{}
	_ bin.BareDecoder = &KeyboardButtonBuy{}

	_ KeyboardButtonClass = &KeyboardButtonBuy{}
)

func ( *KeyboardButtonBuy) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonBuy) () string {
	if  == nil {
		return "KeyboardButtonBuy(nil)"
	}
	type  KeyboardButtonBuy
	return fmt.Sprintf("KeyboardButtonBuy%+v", (*))
}

// FillFrom fills KeyboardButtonBuy from given interface.
func ( *KeyboardButtonBuy) ( interface {
	() ( string)
}) {
	.Text = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonBuy) () uint32 {
	return KeyboardButtonBuyTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonBuy) () string {
	return "keyboardButtonBuy"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonBuy) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonBuy",
		ID:   KeyboardButtonBuyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonBuy#afd93fbb as nil")
	}
	.PutID(KeyboardButtonBuyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonBuy#afd93fbb as nil")
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonBuy#afd93fbb to nil")
	}
	if  := .ConsumeID(KeyboardButtonBuyTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonBuy#afd93fbb: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonBuy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonBuy#afd93fbb to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonBuy#afd93fbb: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonBuy) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// KeyboardButtonURLAuth represents TL type `keyboardButtonUrlAuth#10b78d29`.
// Button to request a user to authorize via URL using Seamless Telegram Login¹. When
// the user clicks on such a button, messages.requestUrlAuth² should be called,
// providing the button_id and the ID of the container message. The returned
// urlAuthResultRequest³ object will contain more details about the authorization
// request (request_write_access if the bot would like to send messages to the user along
// with the username of the bot which will be used for user authorization). Finally, the
// user can choose to call messages.acceptUrlAuth⁴ to get a urlAuthResultAccepted⁵
// with the URL to open instead of the url of this constructor, or a
// urlAuthResultDefault⁶, in which case the url of this constructor must be opened,
// instead. If the user refuses the authorization request but still wants to open the
// link, the url of this constructor must be used.
//
// Links:
//  1. https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots
//  2. https://core.telegram.org/method/messages.requestUrlAuth
//  3. https://core.telegram.org/constructor/urlAuthResultRequest
//  4. https://core.telegram.org/method/messages.acceptUrlAuth
//  5. https://core.telegram.org/constructor/urlAuthResultAccepted
//  6. https://core.telegram.org/constructor/urlAuthResultDefault
//
// See https://core.telegram.org/constructor/keyboardButtonUrlAuth for reference.
type KeyboardButtonURLAuth struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Button label
	Text string
	// New text of the button in forwarded messages.
	//
	// Use SetFwdText and GetFwdText helpers.
	FwdText string
	// An HTTP URL to be opened with user authorization data added to the query string when
	// the button is pressed. If the user refuses to provide authorization data, the original
	// URL without information about the user will be opened. The data added is the same as
	// described in Receiving authorization data¹.NOTE: Services must always check the hash
	// of the received data to verify the authentication and the integrity of the data as
	// described in Checking authorization².
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#receiving-authorization-data
	//  2) https://core.telegram.org/widgets/login#checking-authorization
	URL string
	// ID of the button to pass to messages.requestUrlAuth¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.requestUrlAuth
	ButtonID int
}

// KeyboardButtonURLAuthTypeID is TL type id of KeyboardButtonURLAuth.
const KeyboardButtonURLAuthTypeID = 0x10b78d29

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonURLAuth) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonURLAuth.
var (
	_ bin.Encoder     = &KeyboardButtonURLAuth{}
	_ bin.Decoder     = &KeyboardButtonURLAuth{}
	_ bin.BareEncoder = &KeyboardButtonURLAuth{}
	_ bin.BareDecoder = &KeyboardButtonURLAuth{}

	_ KeyboardButtonClass = &KeyboardButtonURLAuth{}
)

func ( *KeyboardButtonURLAuth) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.FwdText == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.ButtonID == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonURLAuth) () string {
	if  == nil {
		return "KeyboardButtonURLAuth(nil)"
	}
	type  KeyboardButtonURLAuth
	return fmt.Sprintf("KeyboardButtonURLAuth%+v", (*))
}

// FillFrom fills KeyboardButtonURLAuth from given interface.
func ( *KeyboardButtonURLAuth) ( interface {
	() ( string)
	() ( string,  bool)
	() ( string)
	() ( int)
}) {
	.Text = .()
	if ,  := .();  {
		.FwdText = 
	}

	.URL = .()
	.ButtonID = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonURLAuth) () uint32 {
	return KeyboardButtonURLAuthTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonURLAuth) () string {
	return "keyboardButtonUrlAuth"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonURLAuth) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonUrlAuth",
		ID:   KeyboardButtonURLAuthTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "FwdText",
			SchemaName: "fwd_text",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "ButtonID",
			SchemaName: "button_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonURLAuth) () {
	if !(.FwdText == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrlAuth#10b78d29 as nil")
	}
	.PutID(KeyboardButtonURLAuthTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUrlAuth#10b78d29 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonUrlAuth#10b78d29: field flags: %w", )
	}
	.PutString(.Text)
	if .Flags.Has(0) {
		.PutString(.FwdText)
	}
	.PutString(.URL)
	.PutInt(.ButtonID)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUrlAuth#10b78d29 to nil")
	}
	if  := .ConsumeID(KeyboardButtonURLAuthTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUrlAuth#10b78d29 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field text: %w", )
		}
		.Text = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field fwd_text: %w", )
		}
		.FwdText = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUrlAuth#10b78d29: field button_id: %w", )
		}
		.ButtonID = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// SetFwdText sets value of FwdText conditional field.
func ( *KeyboardButtonURLAuth) ( string) {
	.Flags.Set(0)
	.FwdText = 
}

// GetFwdText returns value of FwdText conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonURLAuth) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .FwdText, true
}

// GetURL returns value of URL field.
func ( *KeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// GetButtonID returns value of ButtonID field.
func ( *KeyboardButtonURLAuth) () ( int) {
	if  == nil {
		return
	}
	return .ButtonID
}

// InputKeyboardButtonURLAuth represents TL type `inputKeyboardButtonUrlAuth#d02e7fd4`.
// Button to request a user to authorize¹ via URL using Seamless Telegram Login².
//
// Links:
//  1. https://core.telegram.org/method/messages.acceptUrlAuth
//  2. https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots
//
// See https://core.telegram.org/constructor/inputKeyboardButtonUrlAuth for reference.
type InputKeyboardButtonURLAuth struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Set this flag to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool
	// Button text
	Text string
	// New text of the button in forwarded messages.
	//
	// Use SetFwdText and GetFwdText helpers.
	FwdText string
	// An HTTP URL to be opened with user authorization data added to the query string when
	// the button is pressed. If the user refuses to provide authorization data, the original
	// URL without information about the user will be opened. The data added is the same as
	// described in Receiving authorization data¹.NOTE: You must always check the hash of
	// the received data to verify the authentication and the integrity of the data as
	// described in Checking authorization².
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#receiving-authorization-data
	//  2) https://core.telegram.org/widgets/login#checking-authorization
	URL string
	// Username of a bot, which will be used for user authorization. See Setting up a bot¹
	// for more details. If not specified, the current bot's username will be assumed. The
	// url's domain must be the same as the domain linked with the bot. See Linking your
	// domain to the bot² for more details.
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#setting-up-a-bot
	//  2) https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot
	Bot InputUserClass
}

// InputKeyboardButtonURLAuthTypeID is TL type id of InputKeyboardButtonURLAuth.
const InputKeyboardButtonURLAuthTypeID = 0xd02e7fd4

// construct implements constructor of KeyboardButtonClass.
func ( InputKeyboardButtonURLAuth) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for InputKeyboardButtonURLAuth.
var (
	_ bin.Encoder     = &InputKeyboardButtonURLAuth{}
	_ bin.Decoder     = &InputKeyboardButtonURLAuth{}
	_ bin.BareEncoder = &InputKeyboardButtonURLAuth{}
	_ bin.BareDecoder = &InputKeyboardButtonURLAuth{}

	_ KeyboardButtonClass = &InputKeyboardButtonURLAuth{}
)

func ( *InputKeyboardButtonURLAuth) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.RequestWriteAccess == false) {
		return false
	}
	if !(.Text == "") {
		return false
	}
	if !(.FwdText == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.Bot == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *InputKeyboardButtonURLAuth) () string {
	if  == nil {
		return "InputKeyboardButtonURLAuth(nil)"
	}
	type  InputKeyboardButtonURLAuth
	return fmt.Sprintf("InputKeyboardButtonURLAuth%+v", (*))
}

// FillFrom fills InputKeyboardButtonURLAuth from given interface.
func ( *InputKeyboardButtonURLAuth) ( interface {
	() ( bool)
	() ( string)
	() ( string,  bool)
	() ( string)
	() ( InputUserClass)
}) {
	.RequestWriteAccess = .()
	.Text = .()
	if ,  := .();  {
		.FwdText = 
	}

	.URL = .()
	.Bot = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputKeyboardButtonURLAuth) () uint32 {
	return InputKeyboardButtonURLAuthTypeID
}

// TypeName returns name of type in TL schema.
func (*InputKeyboardButtonURLAuth) () string {
	return "inputKeyboardButtonUrlAuth"
}

// TypeInfo returns info about TL type.
func ( *InputKeyboardButtonURLAuth) () tdp.Type {
	 := tdp.Type{
		Name: "inputKeyboardButtonUrlAuth",
		ID:   InputKeyboardButtonURLAuthTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "RequestWriteAccess",
			SchemaName: "request_write_access",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "FwdText",
			SchemaName: "fwd_text",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputKeyboardButtonURLAuth) () {
	if !(.RequestWriteAccess == false) {
		.Flags.Set(0)
	}
	if !(.FwdText == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#d02e7fd4 as nil")
	}
	.PutID(InputKeyboardButtonURLAuthTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUrlAuth#d02e7fd4 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field flags: %w", )
	}
	.PutString(.Text)
	if .Flags.Has(1) {
		.PutString(.FwdText)
	}
	.PutString(.URL)
	if .Bot == nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field bot is nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUrlAuth#d02e7fd4: field bot: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#d02e7fd4 to nil")
	}
	if  := .ConsumeID(InputKeyboardButtonURLAuthTypeID);  != nil {
		return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputKeyboardButtonURLAuth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonUrlAuth#d02e7fd4 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field flags: %w", )
		}
	}
	.RequestWriteAccess = .Flags.Has(0)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field text: %w", )
		}
		.Text = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field fwd_text: %w", )
		}
		.FwdText = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field url: %w", )
		}
		.URL = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUrlAuth#d02e7fd4: field bot: %w", )
		}
		.Bot = 
	}
	return nil
}

// SetRequestWriteAccess sets value of RequestWriteAccess conditional field.
func ( *InputKeyboardButtonURLAuth) ( bool) {
	if  {
		.Flags.Set(0)
		.RequestWriteAccess = true
	} else {
		.Flags.Unset(0)
		.RequestWriteAccess = false
	}
}

// GetRequestWriteAccess returns value of RequestWriteAccess conditional field.
func ( *InputKeyboardButtonURLAuth) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetText returns value of Text field.
func ( *InputKeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// SetFwdText sets value of FwdText conditional field.
func ( *InputKeyboardButtonURLAuth) ( string) {
	.Flags.Set(1)
	.FwdText = 
}

// GetFwdText returns value of FwdText conditional field and
// boolean which is true if field was set.
func ( *InputKeyboardButtonURLAuth) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .FwdText, true
}

// GetURL returns value of URL field.
func ( *InputKeyboardButtonURLAuth) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// GetBot returns value of Bot field.
func ( *InputKeyboardButtonURLAuth) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .Bot
}

// KeyboardButtonRequestPoll represents TL type `keyboardButtonRequestPoll#bbc7515d`.
// A button that allows the user to create and send a poll when pressed; available only
// in private
//
// See https://core.telegram.org/constructor/keyboardButtonRequestPoll for reference.
type KeyboardButtonRequestPoll struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, only quiz polls can be sent
	//
	// Use SetQuiz and GetQuiz helpers.
	Quiz bool
	// Button text
	Text string
}

// KeyboardButtonRequestPollTypeID is TL type id of KeyboardButtonRequestPoll.
const KeyboardButtonRequestPollTypeID = 0xbbc7515d

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestPoll) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonRequestPoll.
var (
	_ bin.Encoder     = &KeyboardButtonRequestPoll{}
	_ bin.Decoder     = &KeyboardButtonRequestPoll{}
	_ bin.BareEncoder = &KeyboardButtonRequestPoll{}
	_ bin.BareDecoder = &KeyboardButtonRequestPoll{}

	_ KeyboardButtonClass = &KeyboardButtonRequestPoll{}
)

func ( *KeyboardButtonRequestPoll) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Quiz == false) {
		return false
	}
	if !(.Text == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonRequestPoll) () string {
	if  == nil {
		return "KeyboardButtonRequestPoll(nil)"
	}
	type  KeyboardButtonRequestPoll
	return fmt.Sprintf("KeyboardButtonRequestPoll%+v", (*))
}

// FillFrom fills KeyboardButtonRequestPoll from given interface.
func ( *KeyboardButtonRequestPoll) ( interface {
	() ( bool,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Quiz = 
	}

	.Text = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonRequestPoll) () uint32 {
	return KeyboardButtonRequestPollTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonRequestPoll) () string {
	return "keyboardButtonRequestPoll"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestPoll) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestPoll",
		ID:   KeyboardButtonRequestPollTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Quiz",
			SchemaName: "quiz",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *KeyboardButtonRequestPoll) () {
	if !(.Quiz == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPoll#bbc7515d as nil")
	}
	.PutID(KeyboardButtonRequestPollTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPoll#bbc7515d as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPoll#bbc7515d: field flags: %w", )
	}
	if .Flags.Has(0) {
		.PutBool(.Quiz)
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPoll#bbc7515d to nil")
	}
	if  := .ConsumeID(KeyboardButtonRequestPollTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPoll#bbc7515d to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: field quiz: %w", )
		}
		.Quiz = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPoll#bbc7515d: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// SetQuiz sets value of Quiz conditional field.
func ( *KeyboardButtonRequestPoll) ( bool) {
	.Flags.Set(0)
	.Quiz = 
}

// GetQuiz returns value of Quiz conditional field and
// boolean which is true if field was set.
func ( *KeyboardButtonRequestPoll) () ( bool,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Quiz, true
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestPoll) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// InputKeyboardButtonUserProfile represents TL type `inputKeyboardButtonUserProfile#e988037b`.
// Button that links directly to a user profile
//
// See https://core.telegram.org/constructor/inputKeyboardButtonUserProfile for reference.
type InputKeyboardButtonUserProfile struct {
	// Button text
	Text string
	// User ID
	UserID InputUserClass
}

// InputKeyboardButtonUserProfileTypeID is TL type id of InputKeyboardButtonUserProfile.
const InputKeyboardButtonUserProfileTypeID = 0xe988037b

// construct implements constructor of KeyboardButtonClass.
func ( InputKeyboardButtonUserProfile) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for InputKeyboardButtonUserProfile.
var (
	_ bin.Encoder     = &InputKeyboardButtonUserProfile{}
	_ bin.Decoder     = &InputKeyboardButtonUserProfile{}
	_ bin.BareEncoder = &InputKeyboardButtonUserProfile{}
	_ bin.BareDecoder = &InputKeyboardButtonUserProfile{}

	_ KeyboardButtonClass = &InputKeyboardButtonUserProfile{}
)

func ( *InputKeyboardButtonUserProfile) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.UserID == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *InputKeyboardButtonUserProfile) () string {
	if  == nil {
		return "InputKeyboardButtonUserProfile(nil)"
	}
	type  InputKeyboardButtonUserProfile
	return fmt.Sprintf("InputKeyboardButtonUserProfile%+v", (*))
}

// FillFrom fills InputKeyboardButtonUserProfile from given interface.
func ( *InputKeyboardButtonUserProfile) ( interface {
	() ( string)
	() ( InputUserClass)
}) {
	.Text = .()
	.UserID = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputKeyboardButtonUserProfile) () uint32 {
	return InputKeyboardButtonUserProfileTypeID
}

// TypeName returns name of type in TL schema.
func (*InputKeyboardButtonUserProfile) () string {
	return "inputKeyboardButtonUserProfile"
}

// TypeInfo returns info about TL type.
func ( *InputKeyboardButtonUserProfile) () tdp.Type {
	 := tdp.Type{
		Name: "inputKeyboardButtonUserProfile",
		ID:   InputKeyboardButtonUserProfileTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#e988037b as nil")
	}
	.PutID(InputKeyboardButtonUserProfileTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputKeyboardButtonUserProfile#e988037b as nil")
	}
	.PutString(.Text)
	if .UserID == nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#e988037b: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputKeyboardButtonUserProfile#e988037b: field user_id: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#e988037b to nil")
	}
	if  := .ConsumeID(InputKeyboardButtonUserProfileTypeID);  != nil {
		return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#e988037b: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputKeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputKeyboardButtonUserProfile#e988037b to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#e988037b: field text: %w", )
		}
		.Text = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode inputKeyboardButtonUserProfile#e988037b: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *InputKeyboardButtonUserProfile) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetUserID returns value of UserID field.
func ( *InputKeyboardButtonUserProfile) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// KeyboardButtonUserProfile represents TL type `keyboardButtonUserProfile#308660c1`.
// Button that links directly to a user profile
//
// See https://core.telegram.org/constructor/keyboardButtonUserProfile for reference.
type KeyboardButtonUserProfile struct {
	// Button text
	Text string
	// User ID
	UserID int64
}

// KeyboardButtonUserProfileTypeID is TL type id of KeyboardButtonUserProfile.
const KeyboardButtonUserProfileTypeID = 0x308660c1

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonUserProfile) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonUserProfile.
var (
	_ bin.Encoder     = &KeyboardButtonUserProfile{}
	_ bin.Decoder     = &KeyboardButtonUserProfile{}
	_ bin.BareEncoder = &KeyboardButtonUserProfile{}
	_ bin.BareDecoder = &KeyboardButtonUserProfile{}

	_ KeyboardButtonClass = &KeyboardButtonUserProfile{}
)

func ( *KeyboardButtonUserProfile) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.UserID == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonUserProfile) () string {
	if  == nil {
		return "KeyboardButtonUserProfile(nil)"
	}
	type  KeyboardButtonUserProfile
	return fmt.Sprintf("KeyboardButtonUserProfile%+v", (*))
}

// FillFrom fills KeyboardButtonUserProfile from given interface.
func ( *KeyboardButtonUserProfile) ( interface {
	() ( string)
	() ( int64)
}) {
	.Text = .()
	.UserID = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonUserProfile) () uint32 {
	return KeyboardButtonUserProfileTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonUserProfile) () string {
	return "keyboardButtonUserProfile"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonUserProfile) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonUserProfile",
		ID:   KeyboardButtonUserProfileTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUserProfile#308660c1 as nil")
	}
	.PutID(KeyboardButtonUserProfileTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonUserProfile#308660c1 as nil")
	}
	.PutString(.Text)
	.PutLong(.UserID)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUserProfile#308660c1 to nil")
	}
	if  := .ConsumeID(KeyboardButtonUserProfileTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonUserProfile#308660c1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonUserProfile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonUserProfile#308660c1 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUserProfile#308660c1: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonUserProfile#308660c1: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonUserProfile) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetUserID returns value of UserID field.
func ( *KeyboardButtonUserProfile) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

// KeyboardButtonWebView represents TL type `keyboardButtonWebView#13767230`.
// Button to open a bot mini app¹ using messages.requestWebView², sending over user
// information after user confirmation.
// Can only be sent or received as part of an inline keyboard, use
// keyboardButtonSimpleWebView¹ for reply keyboards.
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps
//  2. https://core.telegram.org/method/messages.requestWebView
//  3. https://core.telegram.org/constructor/keyboardButtonSimpleWebView
//
// See https://core.telegram.org/constructor/keyboardButtonWebView for reference.
type KeyboardButtonWebView struct {
	// Button text
	Text string
	// Web app url¹
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/webapps
	URL string
}

// KeyboardButtonWebViewTypeID is TL type id of KeyboardButtonWebView.
const KeyboardButtonWebViewTypeID = 0x13767230

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonWebView) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonWebView.
var (
	_ bin.Encoder     = &KeyboardButtonWebView{}
	_ bin.Decoder     = &KeyboardButtonWebView{}
	_ bin.BareEncoder = &KeyboardButtonWebView{}
	_ bin.BareDecoder = &KeyboardButtonWebView{}

	_ KeyboardButtonClass = &KeyboardButtonWebView{}
)

func ( *KeyboardButtonWebView) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonWebView) () string {
	if  == nil {
		return "KeyboardButtonWebView(nil)"
	}
	type  KeyboardButtonWebView
	return fmt.Sprintf("KeyboardButtonWebView%+v", (*))
}

// FillFrom fills KeyboardButtonWebView from given interface.
func ( *KeyboardButtonWebView) ( interface {
	() ( string)
	() ( string)
}) {
	.Text = .()
	.URL = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonWebView) () uint32 {
	return KeyboardButtonWebViewTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonWebView) () string {
	return "keyboardButtonWebView"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonWebView) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonWebView",
		ID:   KeyboardButtonWebViewTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonWebView#13767230 as nil")
	}
	.PutID(KeyboardButtonWebViewTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonWebView#13767230 as nil")
	}
	.PutString(.Text)
	.PutString(.URL)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonWebView#13767230 to nil")
	}
	if  := .ConsumeID(KeyboardButtonWebViewTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonWebView#13767230: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonWebView#13767230 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonWebView#13767230: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonWebView#13767230: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonWebView) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetURL returns value of URL field.
func ( *KeyboardButtonWebView) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// KeyboardButtonSimpleWebView represents TL type `keyboardButtonSimpleWebView#a0c0505c`.
// Button to open a bot mini app¹ using messages.requestSimpleWebView², without sending
// user information to the web app.
// Can only be sent or received as part of a reply keyboard, use keyboardButtonWebView¹
// for inline keyboards.
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps
//  2. https://core.telegram.org/method/messages.requestSimpleWebView
//  3. https://core.telegram.org/constructor/keyboardButtonWebView
//
// See https://core.telegram.org/constructor/keyboardButtonSimpleWebView for reference.
type KeyboardButtonSimpleWebView struct {
	// Button text
	Text string
	// Web app URL¹
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/webapps
	URL string
}

// KeyboardButtonSimpleWebViewTypeID is TL type id of KeyboardButtonSimpleWebView.
const KeyboardButtonSimpleWebViewTypeID = 0xa0c0505c

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonSimpleWebView) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonSimpleWebView.
var (
	_ bin.Encoder     = &KeyboardButtonSimpleWebView{}
	_ bin.Decoder     = &KeyboardButtonSimpleWebView{}
	_ bin.BareEncoder = &KeyboardButtonSimpleWebView{}
	_ bin.BareDecoder = &KeyboardButtonSimpleWebView{}

	_ KeyboardButtonClass = &KeyboardButtonSimpleWebView{}
)

func ( *KeyboardButtonSimpleWebView) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonSimpleWebView) () string {
	if  == nil {
		return "KeyboardButtonSimpleWebView(nil)"
	}
	type  KeyboardButtonSimpleWebView
	return fmt.Sprintf("KeyboardButtonSimpleWebView%+v", (*))
}

// FillFrom fills KeyboardButtonSimpleWebView from given interface.
func ( *KeyboardButtonSimpleWebView) ( interface {
	() ( string)
	() ( string)
}) {
	.Text = .()
	.URL = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonSimpleWebView) () uint32 {
	return KeyboardButtonSimpleWebViewTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonSimpleWebView) () string {
	return "keyboardButtonSimpleWebView"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonSimpleWebView) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonSimpleWebView",
		ID:   KeyboardButtonSimpleWebViewTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSimpleWebView#a0c0505c as nil")
	}
	.PutID(KeyboardButtonSimpleWebViewTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonSimpleWebView#a0c0505c as nil")
	}
	.PutString(.Text)
	.PutString(.URL)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonSimpleWebView#a0c0505c to nil")
	}
	if  := .ConsumeID(KeyboardButtonSimpleWebViewTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#a0c0505c: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonSimpleWebView) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonSimpleWebView#a0c0505c to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#a0c0505c: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonSimpleWebView#a0c0505c: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonSimpleWebView) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetURL returns value of URL field.
func ( *KeyboardButtonSimpleWebView) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// KeyboardButtonRequestPeer represents TL type `keyboardButtonRequestPeer#53d7bfd8`.
// Prompts the user to select and share a peer with the bot using messages
// sendBotRequestedPeer¹
//
// Links:
//  1. https://core.telegram.org/method/messages.sendBotRequestedPeer
//
// See https://core.telegram.org/constructor/keyboardButtonRequestPeer for reference.
type KeyboardButtonRequestPeer struct {
	// Button text
	Text string
	// Button ID, to be passed to messages.sendBotRequestedPeer¹.
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.sendBotRequestedPeer
	ButtonID int
	// Filtering criteria to use for the peer selection list shown to the user. The list
	// should display all existing peers of the specified type, and should also offer an
	// option for the user to create and immediately use a peer of the specified type, if
	// needed.
	PeerType RequestPeerTypeClass
	// MaxQuantity field of KeyboardButtonRequestPeer.
	MaxQuantity int
}

// KeyboardButtonRequestPeerTypeID is TL type id of KeyboardButtonRequestPeer.
const KeyboardButtonRequestPeerTypeID = 0x53d7bfd8

// construct implements constructor of KeyboardButtonClass.
func ( KeyboardButtonRequestPeer) () KeyboardButtonClass { return & }

// Ensuring interfaces in compile-time for KeyboardButtonRequestPeer.
var (
	_ bin.Encoder     = &KeyboardButtonRequestPeer{}
	_ bin.Decoder     = &KeyboardButtonRequestPeer{}
	_ bin.BareEncoder = &KeyboardButtonRequestPeer{}
	_ bin.BareDecoder = &KeyboardButtonRequestPeer{}

	_ KeyboardButtonClass = &KeyboardButtonRequestPeer{}
)

func ( *KeyboardButtonRequestPeer) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}
	if !(.ButtonID == 0) {
		return false
	}
	if !(.PeerType == nil) {
		return false
	}
	if !(.MaxQuantity == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *KeyboardButtonRequestPeer) () string {
	if  == nil {
		return "KeyboardButtonRequestPeer(nil)"
	}
	type  KeyboardButtonRequestPeer
	return fmt.Sprintf("KeyboardButtonRequestPeer%+v", (*))
}

// FillFrom fills KeyboardButtonRequestPeer from given interface.
func ( *KeyboardButtonRequestPeer) ( interface {
	() ( string)
	() ( int)
	() ( RequestPeerTypeClass)
	() ( int)
}) {
	.Text = .()
	.ButtonID = .()
	.PeerType = .()
	.MaxQuantity = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*KeyboardButtonRequestPeer) () uint32 {
	return KeyboardButtonRequestPeerTypeID
}

// TypeName returns name of type in TL schema.
func (*KeyboardButtonRequestPeer) () string {
	return "keyboardButtonRequestPeer"
}

// TypeInfo returns info about TL type.
func ( *KeyboardButtonRequestPeer) () tdp.Type {
	 := tdp.Type{
		Name: "keyboardButtonRequestPeer",
		ID:   KeyboardButtonRequestPeerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "ButtonID",
			SchemaName: "button_id",
		},
		{
			Name:       "PeerType",
			SchemaName: "peer_type",
		},
		{
			Name:       "MaxQuantity",
			SchemaName: "max_quantity",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil")
	}
	.PutID(KeyboardButtonRequestPeerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode keyboardButtonRequestPeer#53d7bfd8 as nil")
	}
	.PutString(.Text)
	.PutInt(.ButtonID)
	if .PeerType == nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type is nil")
	}
	if  := .PeerType.Encode();  != nil {
		return fmt.Errorf("unable to encode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w", )
	}
	.PutInt(.MaxQuantity)
	return nil
}

// Decode implements bin.Decoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil")
	}
	if  := .ConsumeID(KeyboardButtonRequestPeerTypeID);  != nil {
		return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *KeyboardButtonRequestPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode keyboardButtonRequestPeer#53d7bfd8 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field button_id: %w", )
		}
		.ButtonID = 
	}
	{
		,  := DecodeRequestPeerType()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field peer_type: %w", )
		}
		.PeerType = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode keyboardButtonRequestPeer#53d7bfd8: field max_quantity: %w", )
		}
		.MaxQuantity = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *KeyboardButtonRequestPeer) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// GetButtonID returns value of ButtonID field.
func ( *KeyboardButtonRequestPeer) () ( int) {
	if  == nil {
		return
	}
	return .ButtonID
}

// GetPeerType returns value of PeerType field.
func ( *KeyboardButtonRequestPeer) () ( RequestPeerTypeClass) {
	if  == nil {
		return
	}
	return .PeerType
}

// GetMaxQuantity returns value of MaxQuantity field.
func ( *KeyboardButtonRequestPeer) () ( int) {
	if  == nil {
		return
	}
	return .MaxQuantity
}

// KeyboardButtonClassName is schema name of KeyboardButtonClass.
const KeyboardButtonClassName = "KeyboardButton"

// KeyboardButtonClass represents KeyboardButton generic type.
//
// See https://core.telegram.org/type/KeyboardButton for reference.
//
// Example:
//
//	g, err := tg.DecodeKeyboardButton(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.KeyboardButton: // keyboardButton#a2fa4880
//	case *tg.KeyboardButtonURL: // keyboardButtonUrl#258aff05
//	case *tg.KeyboardButtonCallback: // keyboardButtonCallback#35bbdb6b
//	case *tg.KeyboardButtonRequestPhone: // keyboardButtonRequestPhone#b16a6c29
//	case *tg.KeyboardButtonRequestGeoLocation: // keyboardButtonRequestGeoLocation#fc796b3f
//	case *tg.KeyboardButtonSwitchInline: // keyboardButtonSwitchInline#93b9fbb5
//	case *tg.KeyboardButtonGame: // keyboardButtonGame#50f41ccf
//	case *tg.KeyboardButtonBuy: // keyboardButtonBuy#afd93fbb
//	case *tg.KeyboardButtonURLAuth: // keyboardButtonUrlAuth#10b78d29
//	case *tg.InputKeyboardButtonURLAuth: // inputKeyboardButtonUrlAuth#d02e7fd4
//	case *tg.KeyboardButtonRequestPoll: // keyboardButtonRequestPoll#bbc7515d
//	case *tg.InputKeyboardButtonUserProfile: // inputKeyboardButtonUserProfile#e988037b
//	case *tg.KeyboardButtonUserProfile: // keyboardButtonUserProfile#308660c1
//	case *tg.KeyboardButtonWebView: // keyboardButtonWebView#13767230
//	case *tg.KeyboardButtonSimpleWebView: // keyboardButtonSimpleWebView#a0c0505c
//	case *tg.KeyboardButtonRequestPeer: // keyboardButtonRequestPeer#53d7bfd8
//	default: panic(v)
//	}
type KeyboardButtonClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() KeyboardButtonClass

	// 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

	// Button text
	GetText() (value string)
}

// DecodeKeyboardButton implements binary de-serialization for KeyboardButtonClass.
func ( *bin.Buffer) (KeyboardButtonClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case KeyboardButtonTypeID:
		// Decoding keyboardButton#a2fa4880.
		 := KeyboardButton{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonURLTypeID:
		// Decoding keyboardButtonUrl#258aff05.
		 := KeyboardButtonURL{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonCallbackTypeID:
		// Decoding keyboardButtonCallback#35bbdb6b.
		 := KeyboardButtonCallback{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestPhoneTypeID:
		// Decoding keyboardButtonRequestPhone#b16a6c29.
		 := KeyboardButtonRequestPhone{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestGeoLocationTypeID:
		// Decoding keyboardButtonRequestGeoLocation#fc796b3f.
		 := KeyboardButtonRequestGeoLocation{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonSwitchInlineTypeID:
		// Decoding keyboardButtonSwitchInline#93b9fbb5.
		 := KeyboardButtonSwitchInline{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonGameTypeID:
		// Decoding keyboardButtonGame#50f41ccf.
		 := KeyboardButtonGame{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonBuyTypeID:
		// Decoding keyboardButtonBuy#afd93fbb.
		 := KeyboardButtonBuy{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonURLAuthTypeID:
		// Decoding keyboardButtonUrlAuth#10b78d29.
		 := KeyboardButtonURLAuth{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case InputKeyboardButtonURLAuthTypeID:
		// Decoding inputKeyboardButtonUrlAuth#d02e7fd4.
		 := InputKeyboardButtonURLAuth{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestPollTypeID:
		// Decoding keyboardButtonRequestPoll#bbc7515d.
		 := KeyboardButtonRequestPoll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case InputKeyboardButtonUserProfileTypeID:
		// Decoding inputKeyboardButtonUserProfile#e988037b.
		 := InputKeyboardButtonUserProfile{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonUserProfileTypeID:
		// Decoding keyboardButtonUserProfile#308660c1.
		 := KeyboardButtonUserProfile{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonWebViewTypeID:
		// Decoding keyboardButtonWebView#13767230.
		 := KeyboardButtonWebView{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonSimpleWebViewTypeID:
		// Decoding keyboardButtonSimpleWebView#a0c0505c.
		 := KeyboardButtonSimpleWebView{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	case KeyboardButtonRequestPeerTypeID:
		// Decoding keyboardButtonRequestPeer#53d7bfd8.
		 := KeyboardButtonRequestPeer{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode KeyboardButtonClass: %w", bin.NewUnexpectedID())
	}
}

// KeyboardButton boxes the KeyboardButtonClass providing a helper.
type KeyboardButtonBox struct {
	KeyboardButton KeyboardButtonClass
}

// Decode implements bin.Decoder for KeyboardButtonBox.
func ( *KeyboardButtonBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode KeyboardButtonBox to nil")
	}
	,  := DecodeKeyboardButton()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.KeyboardButton = 
	return nil
}

// Encode implements bin.Encode for KeyboardButtonBox.
func ( *KeyboardButtonBox) ( *bin.Buffer) error {
	if  == nil || .KeyboardButton == nil {
		return fmt.Errorf("unable to encode KeyboardButtonClass as nil")
	}
	return .KeyboardButton.Encode()
}