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

// ChatlistsGetChatlistUpdatesRequest represents TL type `chatlists.getChatlistUpdates#89419521`.
// Fetch new chats associated with an imported chat folder deep link »¹. Must be
// invoked at most every chatlist_update_period seconds (as per the related client
// configuration parameter »²).
//
// Links:
//  1. https://core.telegram.org/api/links#chat-folder-links
//  2. https://core.telegram.org/api/config#chatlist-update-period
//
// See https://core.telegram.org/method/chatlists.getChatlistUpdates for reference.
type ChatlistsGetChatlistUpdatesRequest struct {
	// The folder
	Chatlist InputChatlistDialogFilter
}

// ChatlistsGetChatlistUpdatesRequestTypeID is TL type id of ChatlistsGetChatlistUpdatesRequest.
const ChatlistsGetChatlistUpdatesRequestTypeID = 0x89419521

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

func ( *ChatlistsGetChatlistUpdatesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Chatlist.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills ChatlistsGetChatlistUpdatesRequest from given interface.
func ( *ChatlistsGetChatlistUpdatesRequest) ( interface {
	() ( InputChatlistDialogFilter)
}) {
	.Chatlist = .()
}

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

// TypeName returns name of type in TL schema.
func (*ChatlistsGetChatlistUpdatesRequest) () string {
	return "chatlists.getChatlistUpdates"
}

// TypeInfo returns info about TL type.
func ( *ChatlistsGetChatlistUpdatesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "chatlists.getChatlistUpdates",
		ID:   ChatlistsGetChatlistUpdatesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Chatlist",
			SchemaName: "chatlist",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChatlistsGetChatlistUpdatesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatlists.getChatlistUpdates#89419521 as nil")
	}
	.PutID(ChatlistsGetChatlistUpdatesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChatlistsGetChatlistUpdatesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatlists.getChatlistUpdates#89419521 as nil")
	}
	if  := .Chatlist.Encode();  != nil {
		return fmt.Errorf("unable to encode chatlists.getChatlistUpdates#89419521: field chatlist: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ChatlistsGetChatlistUpdatesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatlists.getChatlistUpdates#89419521 to nil")
	}
	if  := .ConsumeID(ChatlistsGetChatlistUpdatesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode chatlists.getChatlistUpdates#89419521: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChatlistsGetChatlistUpdatesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatlists.getChatlistUpdates#89419521 to nil")
	}
	{
		if  := .Chatlist.Decode();  != nil {
			return fmt.Errorf("unable to decode chatlists.getChatlistUpdates#89419521: field chatlist: %w", )
		}
	}
	return nil
}

// GetChatlist returns value of Chatlist field.
func ( *ChatlistsGetChatlistUpdatesRequest) () ( InputChatlistDialogFilter) {
	if  == nil {
		return
	}
	return .Chatlist
}

// ChatlistsGetChatlistUpdates invokes method chatlists.getChatlistUpdates#89419521 returning error if any.
// Fetch new chats associated with an imported chat folder deep link »¹. Must be
// invoked at most every chatlist_update_period seconds (as per the related client
// configuration parameter »²).
//
// Links:
//  1. https://core.telegram.org/api/links#chat-folder-links
//  2. https://core.telegram.org/api/config#chatlist-update-period
//
// Possible errors:
//
//	400 FILTER_ID_INVALID: The specified filter ID is invalid.
//	400 INPUT_CHATLIST_INVALID: The specified folder is invalid.
//
// See https://core.telegram.org/method/chatlists.getChatlistUpdates for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  InputChatlistDialogFilter) (*ChatlistsChatlistUpdates, error) {
	var  ChatlistsChatlistUpdates

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