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 MessagesSearchCustomEmojiRequest struct {
Emoticon string
Hash int64
}
const MessagesSearchCustomEmojiRequestTypeID = 0x2c11c0d7
var (
_ bin .Encoder = &MessagesSearchCustomEmojiRequest {}
_ bin .Decoder = &MessagesSearchCustomEmojiRequest {}
_ bin .BareEncoder = &MessagesSearchCustomEmojiRequest {}
_ bin .BareDecoder = &MessagesSearchCustomEmojiRequest {}
)
func (s *MessagesSearchCustomEmojiRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Emoticon == "" ) {
return false
}
if !(s .Hash == 0 ) {
return false
}
return true
}
func (s *MessagesSearchCustomEmojiRequest ) String () string {
if s == nil {
return "MessagesSearchCustomEmojiRequest(nil)"
}
type Alias MessagesSearchCustomEmojiRequest
return fmt .Sprintf ("MessagesSearchCustomEmojiRequest%+v" , Alias (*s ))
}
func (s *MessagesSearchCustomEmojiRequest ) FillFrom (from interface {
GetEmoticon () (value string )
GetHash () (value int64 )
}) {
s .Emoticon = from .GetEmoticon ()
s .Hash = from .GetHash ()
}
func (*MessagesSearchCustomEmojiRequest ) TypeID () uint32 {
return MessagesSearchCustomEmojiRequestTypeID
}
func (*MessagesSearchCustomEmojiRequest ) TypeName () string {
return "messages.searchCustomEmoji"
}
func (s *MessagesSearchCustomEmojiRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.searchCustomEmoji" ,
ID : MessagesSearchCustomEmojiRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Emoticon" ,
SchemaName : "emoticon" ,
},
{
Name : "Hash" ,
SchemaName : "hash" ,
},
}
return typ
}
func (s *MessagesSearchCustomEmojiRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.searchCustomEmoji#2c11c0d7 as nil" )
}
b .PutID (MessagesSearchCustomEmojiRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSearchCustomEmojiRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.searchCustomEmoji#2c11c0d7 as nil" )
}
b .PutString (s .Emoticon )
b .PutLong (s .Hash )
return nil
}
func (s *MessagesSearchCustomEmojiRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.searchCustomEmoji#2c11c0d7 to nil" )
}
if err := b .ConsumeID (MessagesSearchCustomEmojiRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.searchCustomEmoji#2c11c0d7: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSearchCustomEmojiRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.searchCustomEmoji#2c11c0d7 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.searchCustomEmoji#2c11c0d7: field emoticon: %w" , err )
}
s .Emoticon = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.searchCustomEmoji#2c11c0d7: field hash: %w" , err )
}
s .Hash = value
}
return nil
}
func (s *MessagesSearchCustomEmojiRequest ) GetEmoticon () (value string ) {
if s == nil {
return
}
return s .Emoticon
}
func (s *MessagesSearchCustomEmojiRequest ) GetHash () (value int64 ) {
if s == nil {
return
}
return s .Hash
}
func (c *Client ) MessagesSearchCustomEmoji (ctx context .Context , request *MessagesSearchCustomEmojiRequest ) (EmojiListClass , error ) {
var result EmojiListBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .EmojiList , 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 .