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

// MessagesGetRecentLocationsRequest represents TL type `messages.getRecentLocations#702a40e0`.
// Get live location history of a certain user
//
// See https://core.telegram.org/method/messages.getRecentLocations for reference.
type MessagesGetRecentLocationsRequest struct {
	// User
	Peer InputPeerClass
	// 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
}

// MessagesGetRecentLocationsRequestTypeID is TL type id of MessagesGetRecentLocationsRequest.
const MessagesGetRecentLocationsRequestTypeID = 0x702a40e0

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesGetRecentLocationsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getRecentLocations#702a40e0 as nil")
	}
	.PutID(MessagesGetRecentLocationsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetRecentLocationsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getRecentLocations#702a40e0 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getRecentLocations#702a40e0: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getRecentLocations#702a40e0: field peer: %w", )
	}
	.PutInt(.Limit)
	.PutLong(.Hash)
	return nil
}

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

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

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

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

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

// MessagesGetRecentLocations invokes method messages.getRecentLocations#702a40e0 returning error if any.
// Get live location history of a certain user
//
// See https://core.telegram.org/method/messages.getRecentLocations for reference.
func ( *Client) ( context.Context,  *MessagesGetRecentLocationsRequest) (MessagesMessagesClass, error) {
	var  MessagesMessagesBox

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