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

// PaymentsGetConnectedStarRefBotRequest represents TL type `payments.getConnectedStarRefBot#b7d998f0`.
// Fetch info about a specific bot affiliation »¹
//
// Links:
//  1. https://core.telegram.org/api/bots/referrals
//
// See https://core.telegram.org/method/payments.getConnectedStarRefBot for reference.
type PaymentsGetConnectedStarRefBotRequest struct {
	// The affiliated peer
	Peer InputPeerClass
	// The bot that offers the affiliate program
	Bot InputUserClass
}

// PaymentsGetConnectedStarRefBotRequestTypeID is TL type id of PaymentsGetConnectedStarRefBotRequest.
const PaymentsGetConnectedStarRefBotRequestTypeID = 0xb7d998f0

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

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

	return true
}

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

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

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

// TypeName returns name of type in TL schema.
func (*PaymentsGetConnectedStarRefBotRequest) () string {
	return "payments.getConnectedStarRefBot"
}

// TypeInfo returns info about TL type.
func ( *PaymentsGetConnectedStarRefBotRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getConnectedStarRefBot",
		ID:   PaymentsGetConnectedStarRefBotRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetConnectedStarRefBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getConnectedStarRefBot#b7d998f0 as nil")
	}
	.PutID(PaymentsGetConnectedStarRefBotRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *PaymentsGetConnectedStarRefBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getConnectedStarRefBot#b7d998f0 to nil")
	}
	if  := .ConsumeID(PaymentsGetConnectedStarRefBotRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.getConnectedStarRefBot#b7d998f0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetConnectedStarRefBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getConnectedStarRefBot#b7d998f0 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getConnectedStarRefBot#b7d998f0: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getConnectedStarRefBot#b7d998f0: field bot: %w", )
		}
		.Bot = 
	}
	return nil
}

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

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

// PaymentsGetConnectedStarRefBot invokes method payments.getConnectedStarRefBot#b7d998f0 returning error if any.
// Fetch info about a specific bot affiliation »¹
//
// Links:
//  1. https://core.telegram.org/api/bots/referrals
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/payments.getConnectedStarRefBot for reference.
func ( *Client) ( context.Context,  *PaymentsGetConnectedStarRefBotRequest) (*PaymentsConnectedStarRefBots, error) {
	var  PaymentsConnectedStarRefBots

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