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

// MessagesGetCustomEmojiDocumentsRequest represents TL type `messages.getCustomEmojiDocuments#d9ab0f54`.
// Fetch custom emoji stickers »¹.
// Returns a list of documents¹ with the animated custom emoji in TGS format, and a
// documentAttributeCustomEmoji² attribute with the original emoji and info about the
// emoji stickerset this custom emoji belongs to.
//
// Links:
//  1. https://core.telegram.org/api/custom-emoji
//  2. https://core.telegram.org/constructor/document
//  3. https://core.telegram.org/constructor/documentAttributeCustomEmoji
//
// See https://core.telegram.org/method/messages.getCustomEmojiDocuments for reference.
type MessagesGetCustomEmojiDocumentsRequest struct {
	// Custom emoji¹ IDs from a messageEntityCustomEmoji².
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	//  2) https://core.telegram.org/constructor/messageEntityCustomEmoji
	DocumentID []int64
}

// MessagesGetCustomEmojiDocumentsRequestTypeID is TL type id of MessagesGetCustomEmojiDocumentsRequest.
const MessagesGetCustomEmojiDocumentsRequestTypeID = 0xd9ab0f54

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

func ( *MessagesGetCustomEmojiDocumentsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.DocumentID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetCustomEmojiDocumentsRequest from given interface.
func ( *MessagesGetCustomEmojiDocumentsRequest) ( interface {
	() ( []int64)
}) {
	.DocumentID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetCustomEmojiDocumentsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getCustomEmojiDocuments",
		ID:   MessagesGetCustomEmojiDocumentsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "DocumentID",
			SchemaName: "document_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetCustomEmojiDocumentsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getCustomEmojiDocuments#d9ab0f54 as nil")
	}
	.PutID(MessagesGetCustomEmojiDocumentsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetCustomEmojiDocumentsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getCustomEmojiDocuments#d9ab0f54 as nil")
	}
	.PutVectorHeader(len(.DocumentID))
	for ,  := range .DocumentID {
		.PutLong()
	}
	return nil
}

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

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

		if  > 0 {
			.DocumentID = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode messages.getCustomEmojiDocuments#d9ab0f54: field document_id: %w", )
			}
			.DocumentID = append(.DocumentID, )
		}
	}
	return nil
}

// GetDocumentID returns value of DocumentID field.
func ( *MessagesGetCustomEmojiDocumentsRequest) () ( []int64) {
	if  == nil {
		return
	}
	return .DocumentID
}

// MessagesGetCustomEmojiDocuments invokes method messages.getCustomEmojiDocuments#d9ab0f54 returning error if any.
// Fetch custom emoji stickers »¹.
// Returns a list of documents¹ with the animated custom emoji in TGS format, and a
// documentAttributeCustomEmoji² attribute with the original emoji and info about the
// emoji stickerset this custom emoji belongs to.
//
// Links:
//  1. https://core.telegram.org/api/custom-emoji
//  2. https://core.telegram.org/constructor/document
//  3. https://core.telegram.org/constructor/documentAttributeCustomEmoji
//
// See https://core.telegram.org/method/messages.getCustomEmojiDocuments for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  []int64) ([]DocumentClass, error) {
	var  DocumentClassVector

	 := &MessagesGetCustomEmojiDocumentsRequest{
		DocumentID: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return []DocumentClass(.Elems), nil
}