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

// BotsGetBotMenuButtonRequest represents TL type `bots.getBotMenuButton#9c60eb28`.
// Gets the menu button action for a given user or for all users, previously set using
// bots.setBotMenuButton¹; users can see this information in the botInfo² constructor.
//
// Links:
//  1. https://core.telegram.org/method/bots.setBotMenuButton
//  2. https://core.telegram.org/constructor/botInfo
//
// See https://core.telegram.org/method/bots.getBotMenuButton for reference.
type BotsGetBotMenuButtonRequest struct {
	// User ID or empty for the default menu button.
	UserID InputUserClass
}

// BotsGetBotMenuButtonRequestTypeID is TL type id of BotsGetBotMenuButtonRequest.
const BotsGetBotMenuButtonRequestTypeID = 0x9c60eb28

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

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

	return true
}

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

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

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

// TypeName returns name of type in TL schema.
func (*BotsGetBotMenuButtonRequest) () string {
	return "bots.getBotMenuButton"
}

// TypeInfo returns info about TL type.
func ( *BotsGetBotMenuButtonRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.getBotMenuButton",
		ID:   BotsGetBotMenuButtonRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotsGetBotMenuButtonRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getBotMenuButton#9c60eb28 as nil")
	}
	.PutID(BotsGetBotMenuButtonRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *BotsGetBotMenuButtonRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.getBotMenuButton#9c60eb28 to nil")
	}
	if  := .ConsumeID(BotsGetBotMenuButtonRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode bots.getBotMenuButton#9c60eb28: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *BotsGetBotMenuButtonRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.getBotMenuButton#9c60eb28 to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getBotMenuButton#9c60eb28: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

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

// BotsGetBotMenuButton invokes method bots.getBotMenuButton#9c60eb28 returning error if any.
// Gets the menu button action for a given user or for all users, previously set using
// bots.setBotMenuButton¹; users can see this information in the botInfo² constructor.
//
// Links:
//  1. https://core.telegram.org/method/bots.setBotMenuButton
//  2. https://core.telegram.org/constructor/botInfo
//
// Possible errors:
//
//	400 USER_BOT_REQUIRED: This method can only be called by a bot.
//
// See https://core.telegram.org/method/bots.getBotMenuButton for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  InputUserClass) (BotMenuButtonClass, error) {
	var  BotMenuButtonBox

	 := &BotsGetBotMenuButtonRequest{
		UserID: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .BotMenuButton, nil
}