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

// MessagesGetRecentStickersRequest represents TL type `messages.getRecentStickers#9da9403b`.
// Get recent stickers
//
// See https://core.telegram.org/method/messages.getRecentStickers for reference.
type MessagesGetRecentStickersRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Get stickers recently attached to photo or video files
	Attached bool
	// Hash for pagination, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
}

// MessagesGetRecentStickersRequestTypeID is TL type id of MessagesGetRecentStickersRequest.
const MessagesGetRecentStickersRequestTypeID = 0x9da9403b

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

func ( *MessagesGetRecentStickersRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Attached == false) {
		return false
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesGetRecentStickersRequest from given interface.
func ( *MessagesGetRecentStickersRequest) ( interface {
	() ( bool)
	() ( int64)
}) {
	.Attached = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesGetRecentStickersRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getRecentStickers",
		ID:   MessagesGetRecentStickersRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Attached",
			SchemaName: "attached",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesGetRecentStickersRequest) () {
	if !(.Attached == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesGetRecentStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getRecentStickers#9da9403b as nil")
	}
	.PutID(MessagesGetRecentStickersRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetRecentStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getRecentStickers#9da9403b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getRecentStickers#9da9403b: field flags: %w", )
	}
	.PutLong(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetRecentStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getRecentStickers#9da9403b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.getRecentStickers#9da9403b: field flags: %w", )
		}
	}
	.Attached = .Flags.Has(0)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getRecentStickers#9da9403b: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// SetAttached sets value of Attached conditional field.
func ( *MessagesGetRecentStickersRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Attached = true
	} else {
		.Flags.Unset(0)
		.Attached = false
	}
}

// GetAttached returns value of Attached conditional field.
func ( *MessagesGetRecentStickersRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetHash returns value of Hash field.
func ( *MessagesGetRecentStickersRequest) () ( int64) {
	if  == nil {
		return
	}
	return .Hash
}

// MessagesGetRecentStickers invokes method messages.getRecentStickers#9da9403b returning error if any.
// Get recent stickers
//
// See https://core.telegram.org/method/messages.getRecentStickers for reference.
func ( *Client) ( context.Context,  *MessagesGetRecentStickersRequest) (MessagesRecentStickersClass, error) {
	var  MessagesRecentStickersBox

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