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

// MessagesClearRecentStickersRequest represents TL type `messages.clearRecentStickers#8999602d`.
// Clear recent stickers
//
// See https://core.telegram.org/method/messages.clearRecentStickers for reference.
type MessagesClearRecentStickersRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Set this flag to clear the list of stickers recently attached to photo or video files
	Attached bool
}

// MessagesClearRecentStickersRequestTypeID is TL type id of MessagesClearRecentStickersRequest.
const MessagesClearRecentStickersRequestTypeID = 0x8999602d

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

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

	return true
}

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

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesClearRecentStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.clearRecentStickers#8999602d as nil")
	}
	.PutID(MessagesClearRecentStickersRequestTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesClearRecentStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.clearRecentStickers#8999602d to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.clearRecentStickers#8999602d: field flags: %w", )
		}
	}
	.Attached = .Flags.Has(0)
	return nil
}

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

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

// MessagesClearRecentStickers invokes method messages.clearRecentStickers#8999602d returning error if any.
// Clear recent stickers
//
// See https://core.telegram.org/method/messages.clearRecentStickers for reference.
func ( *Client) ( context.Context,  *MessagesClearRecentStickersRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}