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

// ChannelsGetChannelsRequest represents TL type `channels.getChannels#a7f6bbb`.
// Get info about channels/supergroups¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/channels.getChannels for reference.
type ChannelsGetChannelsRequest struct {
	// IDs of channels/supergroups to get info about
	ID []InputChannelClass
}

// ChannelsGetChannelsRequestTypeID is TL type id of ChannelsGetChannelsRequest.
const ChannelsGetChannelsRequestTypeID = 0xa7f6bbb

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

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

	return true
}

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

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

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

// TypeName returns name of type in TL schema.
func (*ChannelsGetChannelsRequest) () string {
	return "channels.getChannels"
}

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

// Encode implements bin.Encoder.
func ( *ChannelsGetChannelsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getChannels#a7f6bbb as nil")
	}
	.PutID(ChannelsGetChannelsRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *ChannelsGetChannelsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.getChannels#a7f6bbb to nil")
	}
	if  := .ConsumeID(ChannelsGetChannelsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.getChannels#a7f6bbb: %w", )
	}
	return .DecodeBare()
}

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

		if  > 0 {
			.ID = make([]InputChannelClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputChannel()
			if  != nil {
				return fmt.Errorf("unable to decode channels.getChannels#a7f6bbb: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	return nil
}

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

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

// ChannelsGetChannels invokes method channels.getChannels#a7f6bbb returning error if any.
// Get info about channels/supergroups¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// 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 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels.
//
// See https://core.telegram.org/method/channels.getChannels for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  []InputChannelClass) (MessagesChatsClass, error) {
	var  MessagesChatsBox

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