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

// MessagesGetMessagesRequest represents TL type `messages.getMessages#63c66506`.
// Returns the list of messages by their IDs.
//
// See https://core.telegram.org/method/messages.getMessages for reference.
type MessagesGetMessagesRequest struct {
	// Message ID list
	ID []InputMessageClass
}

// MessagesGetMessagesRequestTypeID is TL type id of MessagesGetMessagesRequest.
const MessagesGetMessagesRequestTypeID = 0x63c66506

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

func ( *MessagesGetMessagesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.ID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetMessagesRequest from given interface.
func ( *MessagesGetMessagesRequest) ( interface {
	() ( []InputMessageClass)
}) {
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetMessagesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getMessages",
		ID:   MessagesGetMessagesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessages#63c66506 as nil")
	}
	.PutID(MessagesGetMessagesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessages#63c66506 as nil")
	}
	.PutVectorHeader(len(.ID))
	for ,  := range .ID {
		if  == nil {
			return fmt.Errorf("unable to encode messages.getMessages#63c66506: field id element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.getMessages#63c66506: field id element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesGetMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getMessages#63c66506 to nil")
	}
	if  := .ConsumeID(MessagesGetMessagesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.getMessages#63c66506: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetMessagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getMessages#63c66506 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessages#63c66506: field id: %w", )
		}

		if  > 0 {
			.ID = make([]InputMessageClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputMessage()
			if  != nil {
				return fmt.Errorf("unable to decode messages.getMessages#63c66506: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	return nil
}

// GetID returns value of ID field.
func ( *MessagesGetMessagesRequest) () ( []InputMessageClass) {
	if  == nil {
		return
	}
	return .ID
}

// MapID returns field ID wrapped in InputMessageClassArray helper.
func ( *MessagesGetMessagesRequest) () ( InputMessageClassArray) {
	return InputMessageClassArray(.ID)
}

// MessagesGetMessages invokes method messages.getMessages#63c66506 returning error if any.
// Returns the list of messages by their IDs.
//
// See https://core.telegram.org/method/messages.getMessages for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  []InputMessageClass) (MessagesMessagesClass, error) {
	var  MessagesMessagesBox

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