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

// MessagesGetRepliesRequest represents TL type `messages.getReplies#22ddd30c`.
// Get messages in a reply thread
//
// See https://core.telegram.org/method/messages.getReplies for reference.
type MessagesGetRepliesRequest struct {
	// Peer
	Peer InputPeerClass
	// Message ID
	MsgID int
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	OffsetID int
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	OffsetDate int
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	AddOffset int
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
	// If a positive value was transferred, the method will return only messages with ID
	// smaller than max_id
	MaxID int
	// If a positive value was transferred, the method will return only messages with ID
	// bigger than min_id
	MinID int
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
}

// MessagesGetRepliesRequestTypeID is TL type id of MessagesGetRepliesRequest.
const MessagesGetRepliesRequestTypeID = 0x22ddd30c

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

func ( *MessagesGetRepliesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.OffsetID == 0) {
		return false
	}
	if !(.OffsetDate == 0) {
		return false
	}
	if !(.AddOffset == 0) {
		return false
	}
	if !(.Limit == 0) {
		return false
	}
	if !(.MaxID == 0) {
		return false
	}
	if !(.MinID == 0) {
		return false
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetRepliesRequest from given interface.
func ( *MessagesGetRepliesRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
	() ( int64)
}) {
	.Peer = .()
	.MsgID = .()
	.OffsetID = .()
	.OffsetDate = .()
	.AddOffset = .()
	.Limit = .()
	.MaxID = .()
	.MinID = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetRepliesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getReplies",
		ID:   MessagesGetRepliesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "OffsetID",
			SchemaName: "offset_id",
		},
		{
			Name:       "OffsetDate",
			SchemaName: "offset_date",
		},
		{
			Name:       "AddOffset",
			SchemaName: "add_offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
		{
			Name:       "MaxID",
			SchemaName: "max_id",
		},
		{
			Name:       "MinID",
			SchemaName: "min_id",
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getReplies#22ddd30c as nil")
	}
	.PutID(MessagesGetRepliesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getReplies#22ddd30c as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getReplies#22ddd30c: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getReplies#22ddd30c: field peer: %w", )
	}
	.PutInt(.MsgID)
	.PutInt(.OffsetID)
	.PutInt(.OffsetDate)
	.PutInt(.AddOffset)
	.PutInt(.Limit)
	.PutInt(.MaxID)
	.PutInt(.MinID)
	.PutLong(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getReplies#22ddd30c to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field msg_id: %w", )
		}
		.MsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field offset_id: %w", )
		}
		.OffsetID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field offset_date: %w", )
		}
		.OffsetDate = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field add_offset: %w", )
		}
		.AddOffset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field limit: %w", )
		}
		.Limit = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field max_id: %w", )
		}
		.MaxID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field min_id: %w", )
		}
		.MinID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getReplies#22ddd30c: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

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

// GetMsgID returns value of MsgID field.
func ( *MessagesGetRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .MsgID
}

// GetOffsetID returns value of OffsetID field.
func ( *MessagesGetRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .OffsetID
}

// GetOffsetDate returns value of OffsetDate field.
func ( *MessagesGetRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .OffsetDate
}

// GetAddOffset returns value of AddOffset field.
func ( *MessagesGetRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .AddOffset
}

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

// GetMaxID returns value of MaxID field.
func ( *MessagesGetRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .MaxID
}

// GetMinID returns value of MinID field.
func ( *MessagesGetRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .MinID
}

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

// MessagesGetReplies invokes method messages.getReplies#22ddd30c returning error if any.
// Get messages in a reply thread
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 TOPIC_ID_INVALID: The specified topic ID is invalid.
//
// See https://core.telegram.org/method/messages.getReplies for reference.
func ( *Client) ( context.Context,  *MessagesGetRepliesRequest) (MessagesMessagesClass, error) {
	var  MessagesMessagesBox

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