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

// MessagesGetTopReactionsRequest represents TL type `messages.getTopReactions#bb8125ba`.
// Got popular message reactions¹
//
// Links:
//  1. https://core.telegram.org/api/reactions
//
// See https://core.telegram.org/method/messages.getTopReactions for reference.
type MessagesGetTopReactionsRequest struct {
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
}

// MessagesGetTopReactionsRequestTypeID is TL type id of MessagesGetTopReactionsRequest.
const MessagesGetTopReactionsRequestTypeID = 0xbb8125ba

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

func ( *MessagesGetTopReactionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Limit == 0) {
		return false
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetTopReactionsRequest from given interface.
func ( *MessagesGetTopReactionsRequest) ( interface {
	() ( int)
	() ( int64)
}) {
	.Limit = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetTopReactionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getTopReactions",
		ID:   MessagesGetTopReactionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetTopReactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getTopReactions#bb8125ba as nil")
	}
	.PutID(MessagesGetTopReactionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetTopReactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getTopReactions#bb8125ba as nil")
	}
	.PutInt(.Limit)
	.PutLong(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetTopReactionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getTopReactions#bb8125ba to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getTopReactions#bb8125ba: field limit: %w", )
		}
		.Limit = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getTopReactions#bb8125ba: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetLimit returns value of Limit field.
func ( *MessagesGetTopReactionsRequest) () ( int) {
	if  == nil {
		return
	}
	return .Limit
}

// GetHash returns value of Hash field.
func ( *MessagesGetTopReactionsRequest) () ( int64) {
	if  == nil {
		return
	}
	return .Hash
}

// MessagesGetTopReactions invokes method messages.getTopReactions#bb8125ba returning error if any.
// Got popular message reactions¹
//
// Links:
//  1. https://core.telegram.org/api/reactions
//
// See https://core.telegram.org/method/messages.getTopReactions for reference.
func ( *Client) ( context.Context,  *MessagesGetTopReactionsRequest) (MessagesReactionsClass, error) {
	var  MessagesReactionsBox

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