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

// MessagesReceivedMessagesRequest represents TL type `messages.receivedMessages#5a954c0`.
// Confirms receipt of messages by a client, cancels PUSH-notification sending.
//
// See https://core.telegram.org/method/messages.receivedMessages for reference.
type MessagesReceivedMessagesRequest struct {
	// Maximum message ID available in a client.
	MaxID int
}

// MessagesReceivedMessagesRequestTypeID is TL type id of MessagesReceivedMessagesRequest.
const MessagesReceivedMessagesRequestTypeID = 0x5a954c0

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

func ( *MessagesReceivedMessagesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.MaxID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesReceivedMessagesRequest from given interface.
func ( *MessagesReceivedMessagesRequest) ( interface {
	() ( int)
}) {
	.MaxID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesReceivedMessagesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.receivedMessages",
		ID:   MessagesReceivedMessagesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MaxID",
			SchemaName: "max_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesReceivedMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.receivedMessages#5a954c0 as nil")
	}
	.PutID(MessagesReceivedMessagesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesReceivedMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.receivedMessages#5a954c0 as nil")
	}
	.PutInt(.MaxID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesReceivedMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.receivedMessages#5a954c0 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.receivedMessages#5a954c0: field max_id: %w", )
		}
		.MaxID = 
	}
	return nil
}

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

// MessagesReceivedMessages invokes method messages.receivedMessages#5a954c0 returning error if any.
// Confirms receipt of messages by a client, cancels PUSH-notification sending.
//
// See https://core.telegram.org/method/messages.receivedMessages for reference.
func ( *Client) ( context.Context,  int) ([]ReceivedNotifyMessage, error) {
	var  ReceivedNotifyMessageVector

	 := &MessagesReceivedMessagesRequest{
		MaxID: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return []ReceivedNotifyMessage(.Elems), nil
}