package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type MessagesSearchEmojiStickerSetsRequest struct {
Flags bin .Fields
ExcludeFeatured bool
Q string
Hash int64
}
const MessagesSearchEmojiStickerSetsRequestTypeID = 0x92b4494c
var (
_ bin .Encoder = &MessagesSearchEmojiStickerSetsRequest {}
_ bin .Decoder = &MessagesSearchEmojiStickerSetsRequest {}
_ bin .BareEncoder = &MessagesSearchEmojiStickerSetsRequest {}
_ bin .BareDecoder = &MessagesSearchEmojiStickerSetsRequest {}
)
func (s *MessagesSearchEmojiStickerSetsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .ExcludeFeatured == false ) {
return false
}
if !(s .Q == "" ) {
return false
}
if !(s .Hash == 0 ) {
return false
}
return true
}
func (s *MessagesSearchEmojiStickerSetsRequest ) String () string {
if s == nil {
return "MessagesSearchEmojiStickerSetsRequest(nil)"
}
type Alias MessagesSearchEmojiStickerSetsRequest
return fmt .Sprintf ("MessagesSearchEmojiStickerSetsRequest%+v" , Alias (*s ))
}
func (s *MessagesSearchEmojiStickerSetsRequest ) FillFrom (from interface {
GetExcludeFeatured () (value bool )
GetQ () (value string )
GetHash () (value int64 )
}) {
s .ExcludeFeatured = from .GetExcludeFeatured ()
s .Q = from .GetQ ()
s .Hash = from .GetHash ()
}
func (*MessagesSearchEmojiStickerSetsRequest ) TypeID () uint32 {
return MessagesSearchEmojiStickerSetsRequestTypeID
}
func (*MessagesSearchEmojiStickerSetsRequest ) TypeName () string {
return "messages.searchEmojiStickerSets"
}
func (s *MessagesSearchEmojiStickerSetsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.searchEmojiStickerSets" ,
ID : MessagesSearchEmojiStickerSetsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ExcludeFeatured" ,
SchemaName : "exclude_featured" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "Q" ,
SchemaName : "q" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (s *MessagesSearchEmojiStickerSetsRequest ) SetFlags () {
if !(s .ExcludeFeatured == false ) {
s .Flags .Set (0 )
}
}
func (s *MessagesSearchEmojiStickerSetsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.searchEmojiStickerSets#92b4494c as nil" )
}
b .PutID (MessagesSearchEmojiStickerSetsRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSearchEmojiStickerSetsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.searchEmojiStickerSets#92b4494c as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.searchEmojiStickerSets#92b4494c: field flags: %w" , err )
}
b .PutString (s .Q )
b .PutLong (s .Hash )
return nil
}
func (s *MessagesSearchEmojiStickerSetsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.searchEmojiStickerSets#92b4494c to nil" )
}
if err := b .ConsumeID (MessagesSearchEmojiStickerSetsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.searchEmojiStickerSets#92b4494c: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSearchEmojiStickerSetsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.searchEmojiStickerSets#92b4494c to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.searchEmojiStickerSets#92b4494c: field flags: %w" , err )
}
}
s .ExcludeFeatured = s .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.searchEmojiStickerSets#92b4494c: field q: %w" , err )
}
s .Q = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.searchEmojiStickerSets#92b4494c: field hash: %w" , err )
}
s .Hash = value
}
return nil
}
func (s *MessagesSearchEmojiStickerSetsRequest ) SetExcludeFeatured (value bool ) {
if value {
s .Flags .Set (0 )
s .ExcludeFeatured = true
} else {
s .Flags .Unset (0 )
s .ExcludeFeatured = false
}
}
func (s *MessagesSearchEmojiStickerSetsRequest ) GetExcludeFeatured () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (0 )
}
func (s *MessagesSearchEmojiStickerSetsRequest ) GetQ () (value string ) {
if s == nil {
return
}
return s .Q
}
func (s *MessagesSearchEmojiStickerSetsRequest ) GetHash () (value int64 ) {
if s == nil {
return
}
return s .Hash
}
func (c *Client ) MessagesSearchEmojiStickerSets (ctx context .Context , request *MessagesSearchEmojiStickerSetsRequest ) (MessagesFoundStickerSetsClass , error ) {
var result MessagesFoundStickerSetsBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .FoundStickerSets , nil
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .