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

// PaymentsGetStarsTransactionsByIDRequest represents TL type `payments.getStarsTransactionsByID#2dca16b8`.
// Obtain info about Telegram Star transactions »¹ using specific transaction IDs.
//
// Links:
//  1. https://core.telegram.org/api/stars#balance-and-transaction-history
//
// See https://core.telegram.org/method/payments.getStarsTransactionsByID for reference.
type PaymentsGetStarsTransactionsByIDRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, returns channel/bot ad revenue transactions in nanotons.
	Ton bool
	// Channel or bot.
	Peer InputPeerClass
	// Transaction IDs.
	ID []InputStarsTransaction
}

// PaymentsGetStarsTransactionsByIDRequestTypeID is TL type id of PaymentsGetStarsTransactionsByIDRequest.
const PaymentsGetStarsTransactionsByIDRequestTypeID = 0x2dca16b8

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

func ( *PaymentsGetStarsTransactionsByIDRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Ton == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsGetStarsTransactionsByIDRequest from given interface.
func ( *PaymentsGetStarsTransactionsByIDRequest) ( interface {
	() ( bool)
	() ( InputPeerClass)
	() ( []InputStarsTransaction)
}) {
	.Ton = .()
	.Peer = .()
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsGetStarsTransactionsByIDRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getStarsTransactionsByID",
		ID:   PaymentsGetStarsTransactionsByIDRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Ton",
			SchemaName: "ton",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PaymentsGetStarsTransactionsByIDRequest) () {
	if !(.Ton == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *PaymentsGetStarsTransactionsByIDRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarsTransactionsByID#2dca16b8 as nil")
	}
	.PutID(PaymentsGetStarsTransactionsByIDRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarsTransactionsByIDRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarsTransactionsByID#2dca16b8 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#2dca16b8: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#2dca16b8: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#2dca16b8: field peer: %w", )
	}
	.PutVectorHeader(len(.ID))
	for ,  := range .ID {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode payments.getStarsTransactionsByID#2dca16b8: field id element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetStarsTransactionsByIDRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarsTransactionsByID#2dca16b8 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#2dca16b8: field flags: %w", )
		}
	}
	.Ton = .Flags.Has(0)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#2dca16b8: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#2dca16b8: field id: %w", )
		}

		if  > 0 {
			.ID = make([]InputStarsTransaction, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  InputStarsTransaction
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode payments.getStarsTransactionsByID#2dca16b8: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	return nil
}

// SetTon sets value of Ton conditional field.
func ( *PaymentsGetStarsTransactionsByIDRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Ton = true
	} else {
		.Flags.Unset(0)
		.Ton = false
	}
}

// GetTon returns value of Ton conditional field.
func ( *PaymentsGetStarsTransactionsByIDRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

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

// GetID returns value of ID field.
func ( *PaymentsGetStarsTransactionsByIDRequest) () ( []InputStarsTransaction) {
	if  == nil {
		return
	}
	return .ID
}

// PaymentsGetStarsTransactionsByID invokes method payments.getStarsTransactionsByID#2dca16b8 returning error if any.
// Obtain info about Telegram Star transactions »¹ using specific transaction IDs.
//
// Links:
//  1. https://core.telegram.org/api/stars#balance-and-transaction-history
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 TRANSACTION_ID_INVALID: The specified transaction ID is invalid.
//
// See https://core.telegram.org/method/payments.getStarsTransactionsByID for reference.
func ( *Client) ( context.Context,  *PaymentsGetStarsTransactionsByIDRequest) (*PaymentsStarsStatus, error) {
	var  PaymentsStarsStatus

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