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

// MessagesGetPeerDialogsRequest represents TL type `messages.getPeerDialogs#e470bcfd`.
// Get dialog info of specified peers
//
// See https://core.telegram.org/method/messages.getPeerDialogs for reference.
type MessagesGetPeerDialogsRequest struct {
	// Peers
	Peers []InputDialogPeerClass
}

// MessagesGetPeerDialogsRequestTypeID is TL type id of MessagesGetPeerDialogsRequest.
const MessagesGetPeerDialogsRequestTypeID = 0xe470bcfd

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

func ( *MessagesGetPeerDialogsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peers == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetPeerDialogsRequest from given interface.
func ( *MessagesGetPeerDialogsRequest) ( interface {
	() ( []InputDialogPeerClass)
}) {
	.Peers = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetPeerDialogsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getPeerDialogs",
		ID:   MessagesGetPeerDialogsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peers",
			SchemaName: "peers",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetPeerDialogsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getPeerDialogs#e470bcfd as nil")
	}
	.PutID(MessagesGetPeerDialogsRequestTypeID)
	return .EncodeBare()
}

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

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

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

		if  > 0 {
			.Peers = make([]InputDialogPeerClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputDialogPeer()
			if  != nil {
				return fmt.Errorf("unable to decode messages.getPeerDialogs#e470bcfd: field peers: %w", )
			}
			.Peers = append(.Peers, )
		}
	}
	return nil
}

// GetPeers returns value of Peers field.
func ( *MessagesGetPeerDialogsRequest) () ( []InputDialogPeerClass) {
	if  == nil {
		return
	}
	return .Peers
}

// MapPeers returns field Peers wrapped in InputDialogPeerClassArray helper.
func ( *MessagesGetPeerDialogsRequest) () ( InputDialogPeerClassArray) {
	return InputDialogPeerClassArray(.Peers)
}

// MessagesGetPeerDialogs invokes method messages.getPeerDialogs#e470bcfd returning error if any.
// Get dialog info of specified peers
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	406 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.
//
// See https://core.telegram.org/method/messages.getPeerDialogs for reference.
func ( *Client) ( context.Context,  []InputDialogPeerClass) (*MessagesPeerDialogs, error) {
	var  MessagesPeerDialogs

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