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

// MessagesGetMessageReactionsListRequest represents TL type `messages.getMessageReactionsList#461b3f48`.
// Get message reaction¹ list, along with the sender of each reaction.
//
// Links:
//  1. https://core.telegram.org/api/reactions
//
// See https://core.telegram.org/method/messages.getMessageReactionsList for reference.
type MessagesGetMessageReactionsListRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Peer
	Peer InputPeerClass
	// Message ID
	ID int
	// Get only reactions of this type (UTF8 emoji)
	//
	// Use SetReaction and GetReaction helpers.
	Reaction ReactionClass
	// Offset (typically taken from the next_offset field of the returned messages
	// MessageReactionsList¹)
	//
	// Links:
	//  1) https://core.telegram.org/type/messages.MessageReactionsList
	//
	// Use SetOffset and GetOffset helpers.
	Offset string
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// MessagesGetMessageReactionsListRequestTypeID is TL type id of MessagesGetMessageReactionsListRequest.
const MessagesGetMessageReactionsListRequestTypeID = 0x461b3f48

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

func ( *MessagesGetMessageReactionsListRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == 0) {
		return false
	}
	if !(.Reaction == nil) {
		return false
	}
	if !(.Offset == "") {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetMessageReactionsListRequest from given interface.
func ( *MessagesGetMessageReactionsListRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
	() ( ReactionClass,  bool)
	() ( string,  bool)
	() ( int)
}) {
	.Peer = .()
	.ID = .()
	if ,  := .();  {
		.Reaction = 
	}

	if ,  := .();  {
		.Offset = 
	}

	.Limit = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetMessageReactionsListRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getMessageReactionsList",
		ID:   MessagesGetMessageReactionsListRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Reaction",
			SchemaName: "reaction",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesGetMessageReactionsListRequest) () {
	if !(.Reaction == nil) {
		.Flags.Set(0)
	}
	if !(.Offset == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesGetMessageReactionsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessageReactionsList#461b3f48 as nil")
	}
	.PutID(MessagesGetMessageReactionsListRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetMessageReactionsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessageReactionsList#461b3f48 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getMessageReactionsList#461b3f48: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getMessageReactionsList#461b3f48: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getMessageReactionsList#461b3f48: field peer: %w", )
	}
	.PutInt(.ID)
	if .Flags.Has(0) {
		if .Reaction == nil {
			return fmt.Errorf("unable to encode messages.getMessageReactionsList#461b3f48: field reaction is nil")
		}
		if  := .Reaction.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.getMessageReactionsList#461b3f48: field reaction: %w", )
		}
	}
	if .Flags.Has(1) {
		.PutString(.Offset)
	}
	.PutInt(.Limit)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetMessageReactionsListRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getMessageReactionsList#461b3f48 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReactionsList#461b3f48: field flags: %w", )
		}
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReactionsList#461b3f48: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReactionsList#461b3f48: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := DecodeReaction()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReactionsList#461b3f48: field reaction: %w", )
		}
		.Reaction = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReactionsList#461b3f48: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageReactionsList#461b3f48: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

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

// GetID returns value of ID field.
func ( *MessagesGetMessageReactionsListRequest) () ( int) {
	if  == nil {
		return
	}
	return .ID
}

// SetReaction sets value of Reaction conditional field.
func ( *MessagesGetMessageReactionsListRequest) ( ReactionClass) {
	.Flags.Set(0)
	.Reaction = 
}

// GetReaction returns value of Reaction conditional field and
// boolean which is true if field was set.
func ( *MessagesGetMessageReactionsListRequest) () ( ReactionClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Reaction, true
}

// SetOffset sets value of Offset conditional field.
func ( *MessagesGetMessageReactionsListRequest) ( string) {
	.Flags.Set(1)
	.Offset = 
}

// GetOffset returns value of Offset conditional field and
// boolean which is true if field was set.
func ( *MessagesGetMessageReactionsListRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .Offset, true
}

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

// MessagesGetMessageReactionsList invokes method messages.getMessageReactionsList#461b3f48 returning error if any.
// Get message reaction¹ list, along with the sender of each reaction.
//
// Links:
//  1. https://core.telegram.org/api/reactions
//
// Possible errors:
//
//	403 BROADCAST_FORBIDDEN: Channel poll voters and reactions cannot be fetched to prevent deanonymization.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//
// See https://core.telegram.org/method/messages.getMessageReactionsList for reference.
func ( *Client) ( context.Context,  *MessagesGetMessageReactionsListRequest) (*MessagesMessageReactionsList, error) {
	var  MessagesMessageReactionsList

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