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

// MessagesGetSearchResultsPositionsRequest represents TL type `messages.getSearchResultsPositions#6e9583a3`.
// Returns sparse positions of messages of the specified type in the chat to be used for
// shared media scroll implementation.
// Returns the results in reverse chronological order (i.e., in order of decreasing
// message_id).
//
// See https://core.telegram.org/method/messages.getSearchResultsPositions for reference.
type MessagesGetSearchResultsPositionsRequest struct {
	// Peer where to search
	Peer InputPeerClass
	// Message filter, inputMessagesFilterEmpty¹, inputMessagesFilterMyMentions² filters
	// are not supported by this method.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputMessagesFilterEmpty
	//  2) https://core.telegram.org/constructor/inputMessagesFilterMyMentions
	Filter MessagesFilterClass
	// Offsets for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	OffsetID int
	// Maximum number of results to return, see pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Limit int
}

// MessagesGetSearchResultsPositionsRequestTypeID is TL type id of MessagesGetSearchResultsPositionsRequest.
const MessagesGetSearchResultsPositionsRequestTypeID = 0x6e9583a3

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

func ( *MessagesGetSearchResultsPositionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Filter == nil) {
		return false
	}
	if !(.OffsetID == 0) {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetSearchResultsPositionsRequest from given interface.
func ( *MessagesGetSearchResultsPositionsRequest) ( interface {
	() ( InputPeerClass)
	() ( MessagesFilterClass)
	() ( int)
	() ( int)
}) {
	.Peer = .()
	.Filter = .()
	.OffsetID = .()
	.Limit = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetSearchResultsPositionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getSearchResultsPositions",
		ID:   MessagesGetSearchResultsPositionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Filter",
			SchemaName: "filter",
		},
		{
			Name:       "OffsetID",
			SchemaName: "offset_id",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetSearchResultsPositionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getSearchResultsPositions#6e9583a3 as nil")
	}
	.PutID(MessagesGetSearchResultsPositionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetSearchResultsPositionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getSearchResultsPositions#6e9583a3 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getSearchResultsPositions#6e9583a3: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getSearchResultsPositions#6e9583a3: field peer: %w", )
	}
	if .Filter == nil {
		return fmt.Errorf("unable to encode messages.getSearchResultsPositions#6e9583a3: field filter is nil")
	}
	if  := .Filter.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getSearchResultsPositions#6e9583a3: field filter: %w", )
	}
	.PutInt(.OffsetID)
	.PutInt(.Limit)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetSearchResultsPositionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getSearchResultsPositions#6e9583a3 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getSearchResultsPositions#6e9583a3: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeMessagesFilter()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getSearchResultsPositions#6e9583a3: field filter: %w", )
		}
		.Filter = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getSearchResultsPositions#6e9583a3: field offset_id: %w", )
		}
		.OffsetID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getSearchResultsPositions#6e9583a3: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

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

// GetFilter returns value of Filter field.
func ( *MessagesGetSearchResultsPositionsRequest) () ( MessagesFilterClass) {
	if  == nil {
		return
	}
	return .Filter
}

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

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

// MessagesGetSearchResultsPositions invokes method messages.getSearchResultsPositions#6e9583a3 returning error if any.
// Returns sparse positions of messages of the specified type in the chat to be used for
// shared media scroll implementation.
// Returns the results in reverse chronological order (i.e., in order of decreasing
// message_id).
//
// See https://core.telegram.org/method/messages.getSearchResultsPositions for reference.
func ( *Client) ( context.Context,  *MessagesGetSearchResultsPositionsRequest) (*MessagesSearchResultsPositions, error) {
	var  MessagesSearchResultsPositions

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