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

// AccountGetBotBusinessConnectionRequest represents TL type `account.getBotBusinessConnection#76a86270`.
// Bots may invoke this method to re-fetch the updateBotBusinessConnect¹ constructor
// associated with a specific business connection_id, see here »² for more info on
// connected business bots.
// This is needed for example for freshly logged in bots that are receiving some
// updateBotNewBusinessMessage³, etc. updates because some users have already connected
// to the bot before it could login.
// In this case, the bot is receiving messages from the business connection, but it
// hasn't cached the associated updateBotBusinessConnect⁴ with info about the
// connection (can it reply to messages? etc.) yet, and cannot receive the old ones
// because they were sent when the bot wasn't logged into the session yet.
// This method can be used to fetch info about a not-yet-cached business connection, and
// should not be invoked if the info is already cached or to fetch changes, as eventual
// changes will automatically be sent as new updateBotBusinessConnect⁵ updates to the
// bot using the usual update delivery methods »⁶.
//
// Links:
//  1. https://core.telegram.org/constructor/updateBotBusinessConnect
//  2. https://core.telegram.org/api/bots/connected-business-bots
//  3. https://core.telegram.org/constructor/updateBotNewBusinessMessage
//  4. https://core.telegram.org/constructor/updateBotBusinessConnect
//  5. https://core.telegram.org/constructor/updateBotBusinessConnect
//  6. https://core.telegram.org/api/updates
//
// See https://core.telegram.org/method/account.getBotBusinessConnection for reference.
type AccountGetBotBusinessConnectionRequest struct {
	// Business connection ID »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/connected-business-bots
	ConnectionID string
}

// AccountGetBotBusinessConnectionRequestTypeID is TL type id of AccountGetBotBusinessConnectionRequest.
const AccountGetBotBusinessConnectionRequestTypeID = 0x76a86270

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

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

	return true
}

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

// FillFrom fills AccountGetBotBusinessConnectionRequest from given interface.
func ( *AccountGetBotBusinessConnectionRequest) ( interface {
	() ( string)
}) {
	.ConnectionID = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountGetBotBusinessConnectionRequest) () string {
	return "account.getBotBusinessConnection"
}

// TypeInfo returns info about TL type.
func ( *AccountGetBotBusinessConnectionRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.getBotBusinessConnection",
		ID:   AccountGetBotBusinessConnectionRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ConnectionID",
			SchemaName: "connection_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountGetBotBusinessConnectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getBotBusinessConnection#76a86270 as nil")
	}
	.PutID(AccountGetBotBusinessConnectionRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountGetBotBusinessConnectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getBotBusinessConnection#76a86270 as nil")
	}
	.PutString(.ConnectionID)
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountGetBotBusinessConnectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.getBotBusinessConnection#76a86270 to nil")
	}
	if  := .ConsumeID(AccountGetBotBusinessConnectionRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.getBotBusinessConnection#76a86270: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountGetBotBusinessConnectionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.getBotBusinessConnection#76a86270 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.getBotBusinessConnection#76a86270: field connection_id: %w", )
		}
		.ConnectionID = 
	}
	return nil
}

// GetConnectionID returns value of ConnectionID field.
func ( *AccountGetBotBusinessConnectionRequest) () ( string) {
	if  == nil {
		return
	}
	return .ConnectionID
}

// AccountGetBotBusinessConnection invokes method account.getBotBusinessConnection#76a86270 returning error if any.
// Bots may invoke this method to re-fetch the updateBotBusinessConnect¹ constructor
// associated with a specific business connection_id, see here »² for more info on
// connected business bots.
// This is needed for example for freshly logged in bots that are receiving some
// updateBotNewBusinessMessage³, etc. updates because some users have already connected
// to the bot before it could login.
// In this case, the bot is receiving messages from the business connection, but it
// hasn't cached the associated updateBotBusinessConnect⁴ with info about the
// connection (can it reply to messages? etc.) yet, and cannot receive the old ones
// because they were sent when the bot wasn't logged into the session yet.
// This method can be used to fetch info about a not-yet-cached business connection, and
// should not be invoked if the info is already cached or to fetch changes, as eventual
// changes will automatically be sent as new updateBotBusinessConnect⁵ updates to the
// bot using the usual update delivery methods »⁶.
//
// Links:
//  1. https://core.telegram.org/constructor/updateBotBusinessConnect
//  2. https://core.telegram.org/api/bots/connected-business-bots
//  3. https://core.telegram.org/constructor/updateBotNewBusinessMessage
//  4. https://core.telegram.org/constructor/updateBotBusinessConnect
//  5. https://core.telegram.org/constructor/updateBotBusinessConnect
//  6. https://core.telegram.org/api/updates
//
// Possible errors:
//
//	400 CONNECTION_ID_INVALID: The specified connection ID is invalid.
//
// See https://core.telegram.org/method/account.getBotBusinessConnection for reference.
func ( *Client) ( context.Context,  string) (UpdatesClass, error) {
	var  UpdatesBox

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