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

// MessagesSearchStickerSetsRequest represents TL type `messages.searchStickerSets#35705b8a`.
// Search for stickersets
//
// See https://core.telegram.org/method/messages.searchStickerSets for reference.
type MessagesSearchStickerSetsRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Exclude featured stickersets from results
	ExcludeFeatured bool
	// Query string
	Q string
	// Hash for pagination, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
}

// MessagesSearchStickerSetsRequestTypeID is TL type id of MessagesSearchStickerSetsRequest.
const MessagesSearchStickerSetsRequestTypeID = 0x35705b8a

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

func ( *MessagesSearchStickerSetsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ExcludeFeatured == false) {
		return false
	}
	if !(.Q == "") {
		return false
	}
	if !(.Hash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesSearchStickerSetsRequest from given interface.
func ( *MessagesSearchStickerSetsRequest) ( interface {
	() ( bool)
	() ( string)
	() ( int64)
}) {
	.ExcludeFeatured = .()
	.Q = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesSearchStickerSetsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.searchStickerSets",
		ID:   MessagesSearchStickerSetsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ExcludeFeatured",
			SchemaName: "exclude_featured",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Q",
			SchemaName: "q",
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *MessagesSearchStickerSetsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.searchStickerSets#35705b8a as nil")
	}
	.PutID(MessagesSearchStickerSetsRequestTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesSearchStickerSetsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.searchStickerSets#35705b8a to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.searchStickerSets#35705b8a: field flags: %w", )
		}
	}
	.ExcludeFeatured = .Flags.Has(0)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.searchStickerSets#35705b8a: field q: %w", )
		}
		.Q = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.searchStickerSets#35705b8a: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// SetExcludeFeatured sets value of ExcludeFeatured conditional field.
func ( *MessagesSearchStickerSetsRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.ExcludeFeatured = true
	} else {
		.Flags.Unset(0)
		.ExcludeFeatured = false
	}
}

// GetExcludeFeatured returns value of ExcludeFeatured conditional field.
func ( *MessagesSearchStickerSetsRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetQ returns value of Q field.
func ( *MessagesSearchStickerSetsRequest) () ( string) {
	if  == nil {
		return
	}
	return .Q
}

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

// MessagesSearchStickerSets invokes method messages.searchStickerSets#35705b8a returning error if any.
// Search for stickersets
//
// See https://core.telegram.org/method/messages.searchStickerSets for reference.
func ( *Client) ( context.Context,  *MessagesSearchStickerSetsRequest) (MessagesFoundStickerSetsClass, error) {
	var  MessagesFoundStickerSetsBox

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