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

// MessagesGetPinnedDialogsRequest represents TL type `messages.getPinnedDialogs#d6b94df2`.
// Get pinned dialogs
//
// See https://core.telegram.org/method/messages.getPinnedDialogs for reference.
type MessagesGetPinnedDialogsRequest struct {
	// Peer folder ID, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/folders#peer-folders
	FolderID int
}

// MessagesGetPinnedDialogsRequestTypeID is TL type id of MessagesGetPinnedDialogsRequest.
const MessagesGetPinnedDialogsRequestTypeID = 0xd6b94df2

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

func ( *MessagesGetPinnedDialogsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.FolderID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetPinnedDialogsRequest from given interface.
func ( *MessagesGetPinnedDialogsRequest) ( interface {
	() ( int)
}) {
	.FolderID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetPinnedDialogsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getPinnedDialogs",
		ID:   MessagesGetPinnedDialogsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "FolderID",
			SchemaName: "folder_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetPinnedDialogsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getPinnedDialogs#d6b94df2 as nil")
	}
	.PutID(MessagesGetPinnedDialogsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetPinnedDialogsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getPinnedDialogs#d6b94df2 as nil")
	}
	.PutInt(.FolderID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetPinnedDialogsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getPinnedDialogs#d6b94df2 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getPinnedDialogs#d6b94df2: field folder_id: %w", )
		}
		.FolderID = 
	}
	return nil
}

// GetFolderID returns value of FolderID field.
func ( *MessagesGetPinnedDialogsRequest) () ( int) {
	if  == nil {
		return
	}
	return .FolderID
}

// MessagesGetPinnedDialogs invokes method messages.getPinnedDialogs#d6b94df2 returning error if any.
// Get pinned dialogs
//
// Possible errors:
//
//	400 FOLDER_ID_INVALID: Invalid folder ID.
//
// See https://core.telegram.org/method/messages.getPinnedDialogs for reference.
func ( *Client) ( context.Context,  int) (*MessagesPeerDialogs, error) {
	var  MessagesPeerDialogs

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