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 MessagesSearchStickerSetsRequest struct {
Flags bin .Fields
ExcludeFeatured bool
Q string
Hash int64
}
const MessagesSearchStickerSetsRequestTypeID = 0x35705b8a
var (
_ bin .Encoder = &MessagesSearchStickerSetsRequest {}
_ bin .Decoder = &MessagesSearchStickerSetsRequest {}
_ bin .BareEncoder = &MessagesSearchStickerSetsRequest {}
_ bin .BareDecoder = &MessagesSearchStickerSetsRequest {}
)
func (s *MessagesSearchStickerSetsRequest ) 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 *MessagesSearchStickerSetsRequest ) String () string {
if s == nil {
return "MessagesSearchStickerSetsRequest(nil)"
}
type Alias MessagesSearchStickerSetsRequest
return fmt .Sprintf ("MessagesSearchStickerSetsRequest%+v" , Alias (*s ))
}
func (s *MessagesSearchStickerSetsRequest ) 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 (*MessagesSearchStickerSetsRequest ) TypeID () uint32 {
return MessagesSearchStickerSetsRequestTypeID
}
func (*MessagesSearchStickerSetsRequest ) TypeName () string {
return "messages.searchStickerSets"
}
func (s *MessagesSearchStickerSetsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.searchStickerSets" ,
ID : MessagesSearchStickerSetsRequestTypeID ,
}
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 *MessagesSearchStickerSetsRequest ) SetFlags () {
if !(s .ExcludeFeatured == false ) {
s .Flags .Set (0 )
}
}
func (s *MessagesSearchStickerSetsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.searchStickerSets#35705b8a as nil" )
}
b .PutID (MessagesSearchStickerSetsRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSearchStickerSetsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.searchStickerSets#35705b8a as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.searchStickerSets#35705b8a: field flags: %w" , err )
}
b .PutString (s .Q )
b .PutLong (s .Hash )
return nil
}
func (s *MessagesSearchStickerSetsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.searchStickerSets#35705b8a to nil" )
}
if err := b .ConsumeID (MessagesSearchStickerSetsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.searchStickerSets#35705b8a: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSearchStickerSetsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.searchStickerSets#35705b8a to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.searchStickerSets#35705b8a: field flags: %w" , err )
}
}
s .ExcludeFeatured = s .Flags .Has (0 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.searchStickerSets#35705b8a: field q: %w" , err )
}
s .Q = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.searchStickerSets#35705b8a: field hash: %w" , err )
}
s .Hash = value
}
return nil
}
func (s *MessagesSearchStickerSetsRequest ) SetExcludeFeatured (value bool ) {
if value {
s .Flags .Set (0 )
s .ExcludeFeatured = true
} else {
s .Flags .Unset (0 )
s .ExcludeFeatured = false
}
}
func (s *MessagesSearchStickerSetsRequest ) GetExcludeFeatured () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (0 )
}
func (s *MessagesSearchStickerSetsRequest ) GetQ () (value string ) {
if s == nil {
return
}
return s .Q
}
func (s *MessagesSearchStickerSetsRequest ) GetHash () (value int64 ) {
if s == nil {
return
}
return s .Hash
}
func (c *Client ) MessagesSearchStickerSets (ctx context .Context , request *MessagesSearchStickerSetsRequest ) (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 .