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

// BotsAllowSendMessageRequest represents TL type `bots.allowSendMessage#f132e3ef`.
// Allow the specified bot to send us messages
//
// See https://core.telegram.org/method/bots.allowSendMessage for reference.
type BotsAllowSendMessageRequest struct {
	// The bot
	Bot InputUserClass
}

// BotsAllowSendMessageRequestTypeID is TL type id of BotsAllowSendMessageRequest.
const BotsAllowSendMessageRequestTypeID = 0xf132e3ef

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

func ( *BotsAllowSendMessageRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Bot == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotsAllowSendMessageRequest from given interface.
func ( *BotsAllowSendMessageRequest) ( interface {
	() ( InputUserClass)
}) {
	.Bot = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotsAllowSendMessageRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.allowSendMessage",
		ID:   BotsAllowSendMessageRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotsAllowSendMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.allowSendMessage#f132e3ef as nil")
	}
	.PutID(BotsAllowSendMessageRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsAllowSendMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.allowSendMessage#f132e3ef as nil")
	}
	if .Bot == nil {
		return fmt.Errorf("unable to encode bots.allowSendMessage#f132e3ef: field bot is nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.allowSendMessage#f132e3ef: field bot: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotsAllowSendMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.allowSendMessage#f132e3ef to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode bots.allowSendMessage#f132e3ef: field bot: %w", )
		}
		.Bot = 
	}
	return nil
}

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

// BotsAllowSendMessage invokes method bots.allowSendMessage#f132e3ef returning error if any.
// Allow the specified bot to send us messages
//
// Possible errors:
//
//	400 BOT_INVALID: This is not a valid bot.
//
// See https://core.telegram.org/method/bots.allowSendMessage for reference.
func ( *Client) ( context.Context,  InputUserClass) (UpdatesClass, error) {
	var  UpdatesBox

	 := &BotsAllowSendMessageRequest{
		Bot: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Updates, nil
}