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

// MessagesStartBotRequest represents TL type `messages.startBot#e6df7378`.
// Start a conversation with a bot using a deep linking parameter¹
//
// Links:
//  1. https://core.telegram.org/api/links#bot-links
//
// See https://core.telegram.org/method/messages.startBot for reference.
type MessagesStartBotRequest struct {
	// The bot
	Bot InputUserClass
	// The chat where to start the bot, can be the bot's private chat or a group
	Peer InputPeerClass
	// Random ID to avoid resending the same message
	RandomID int64
	// Deep linking parameter¹
	//
	// Links:
	//  1) https://core.telegram.org/api/links#bot-links
	StartParam string
}

// MessagesStartBotRequestTypeID is TL type id of MessagesStartBotRequest.
const MessagesStartBotRequestTypeID = 0xe6df7378

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

func ( *MessagesStartBotRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Bot == nil) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.RandomID == 0) {
		return false
	}
	if !(.StartParam == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesStartBotRequest from given interface.
func ( *MessagesStartBotRequest) ( interface {
	() ( InputUserClass)
	() ( InputPeerClass)
	() ( int64)
	() ( string)
}) {
	.Bot = .()
	.Peer = .()
	.RandomID = .()
	.StartParam = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesStartBotRequest) () string {
	return "messages.startBot"
}

// TypeInfo returns info about TL type.
func ( *MessagesStartBotRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.startBot",
		ID:   MessagesStartBotRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "RandomID",
			SchemaName: "random_id",
		},
		{
			Name:       "StartParam",
			SchemaName: "start_param",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesStartBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.startBot#e6df7378 as nil")
	}
	.PutID(MessagesStartBotRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesStartBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.startBot#e6df7378 as nil")
	}
	if .Bot == nil {
		return fmt.Errorf("unable to encode messages.startBot#e6df7378: field bot is nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.startBot#e6df7378: field bot: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.startBot#e6df7378: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.startBot#e6df7378: field peer: %w", )
	}
	.PutLong(.RandomID)
	.PutString(.StartParam)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesStartBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.startBot#e6df7378 to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode messages.startBot#e6df7378: field bot: %w", )
		}
		.Bot = 
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.startBot#e6df7378: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.startBot#e6df7378: field random_id: %w", )
		}
		.RandomID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.startBot#e6df7378: field start_param: %w", )
		}
		.StartParam = 
	}
	return nil
}

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

// GetPeer returns value of Peer field.
func ( *MessagesStartBotRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetRandomID returns value of RandomID field.
func ( *MessagesStartBotRequest) () ( int64) {
	if  == nil {
		return
	}
	return .RandomID
}

// GetStartParam returns value of StartParam field.
func ( *MessagesStartBotRequest) () ( string) {
	if  == nil {
		return
	}
	return .StartParam
}

// MessagesStartBot invokes method messages.startBot#e6df7378 returning error if any.
// Start a conversation with a bot using a deep linking parameter¹
//
// Links:
//  1. https://core.telegram.org/api/links#bot-links
//
// Possible errors:
//
//	400 BOT_INVALID: This is not a valid bot.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used.
//	400 START_PARAM_EMPTY: The start parameter is empty.
//	400 START_PARAM_INVALID: Start parameter invalid.
//	400 START_PARAM_TOO_LONG: Start parameter is too long.
//
// See https://core.telegram.org/method/messages.startBot for reference.
func ( *Client) ( context.Context,  *MessagesStartBotRequest) (UpdatesClass, error) {
	var  UpdatesBox

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