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

// BotsGetBotCommandsRequest represents TL type `bots.getBotCommands#e34c0dd6`.
// Obtain a list of bot commands for the specified bot scope and language code
//
// See https://core.telegram.org/method/bots.getBotCommands for reference.
type BotsGetBotCommandsRequest struct {
	// Command scope
	Scope BotCommandScopeClass
	// Language code
	LangCode string
}

// BotsGetBotCommandsRequestTypeID is TL type id of BotsGetBotCommandsRequest.
const BotsGetBotCommandsRequestTypeID = 0xe34c0dd6

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

func ( *BotsGetBotCommandsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Scope == nil) {
		return false
	}
	if !(.LangCode == "") {
		return false
	}

	return true
}

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

// FillFrom fills BotsGetBotCommandsRequest from given interface.
func ( *BotsGetBotCommandsRequest) ( interface {
	() ( BotCommandScopeClass)
	() ( string)
}) {
	.Scope = .()
	.LangCode = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotsGetBotCommandsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.getBotCommands",
		ID:   BotsGetBotCommandsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Scope",
			SchemaName: "scope",
		},
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotsGetBotCommandsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getBotCommands#e34c0dd6 as nil")
	}
	.PutID(BotsGetBotCommandsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsGetBotCommandsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getBotCommands#e34c0dd6 as nil")
	}
	if .Scope == nil {
		return fmt.Errorf("unable to encode bots.getBotCommands#e34c0dd6: field scope is nil")
	}
	if  := .Scope.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.getBotCommands#e34c0dd6: field scope: %w", )
	}
	.PutString(.LangCode)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotsGetBotCommandsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.getBotCommands#e34c0dd6 to nil")
	}
	{
		,  := DecodeBotCommandScope()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getBotCommands#e34c0dd6: field scope: %w", )
		}
		.Scope = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getBotCommands#e34c0dd6: field lang_code: %w", )
		}
		.LangCode = 
	}
	return nil
}

// GetScope returns value of Scope field.
func ( *BotsGetBotCommandsRequest) () ( BotCommandScopeClass) {
	if  == nil {
		return
	}
	return .Scope
}

// GetLangCode returns value of LangCode field.
func ( *BotsGetBotCommandsRequest) () ( string) {
	if  == nil {
		return
	}
	return .LangCode
}

// BotsGetBotCommands invokes method bots.getBotCommands#e34c0dd6 returning error if any.
// Obtain a list of bot commands for the specified bot scope and language code
//
// Possible errors:
//
//	400 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts.
//
// See https://core.telegram.org/method/bots.getBotCommands for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *BotsGetBotCommandsRequest) ([]BotCommand, error) {
	var  BotCommandVector

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return []BotCommand(.Elems), nil
}