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 EmojiGroup struct {
Title string
IconEmojiID int64
Emoticons []string
}
const EmojiGroupTypeID = 0x7a9abda9
var (
_ bin .Encoder = &EmojiGroup {}
_ bin .Decoder = &EmojiGroup {}
_ bin .BareEncoder = &EmojiGroup {}
_ bin .BareDecoder = &EmojiGroup {}
)
func (e *EmojiGroup ) Zero () bool {
if e == nil {
return true
}
if !(e .Title == "" ) {
return false
}
if !(e .IconEmojiID == 0 ) {
return false
}
if !(e .Emoticons == nil ) {
return false
}
return true
}
func (e *EmojiGroup ) String () string {
if e == nil {
return "EmojiGroup(nil)"
}
type Alias EmojiGroup
return fmt .Sprintf ("EmojiGroup%+v" , Alias (*e ))
}
func (e *EmojiGroup ) FillFrom (from interface {
GetTitle () (value string )
GetIconEmojiID () (value int64 )
GetEmoticons () (value []string )
}) {
e .Title = from .GetTitle ()
e .IconEmojiID = from .GetIconEmojiID ()
e .Emoticons = from .GetEmoticons ()
}
func (*EmojiGroup ) TypeID () uint32 {
return EmojiGroupTypeID
}
func (*EmojiGroup ) TypeName () string {
return "emojiGroup"
}
func (e *EmojiGroup ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "emojiGroup" ,
ID : EmojiGroupTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "IconEmojiID" ,
SchemaName : "icon_emoji_id" ,
},
{
Name : "Emoticons" ,
SchemaName : "emoticons" ,
},
}
return typ
}
func (e *EmojiGroup ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiGroup#7a9abda9 as nil" )
}
b .PutID (EmojiGroupTypeID )
return e .EncodeBare (b )
}
func (e *EmojiGroup ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiGroup#7a9abda9 as nil" )
}
b .PutString (e .Title )
b .PutLong (e .IconEmojiID )
b .PutVectorHeader (len (e .Emoticons ))
for _ , v := range e .Emoticons {
b .PutString (v )
}
return nil
}
func (e *EmojiGroup ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiGroup#7a9abda9 to nil" )
}
if err := b .ConsumeID (EmojiGroupTypeID ); err != nil {
return fmt .Errorf ("unable to decode emojiGroup#7a9abda9: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EmojiGroup ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiGroup#7a9abda9 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroup#7a9abda9: field title: %w" , err )
}
e .Title = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroup#7a9abda9: field icon_emoji_id: %w" , err )
}
e .IconEmojiID = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroup#7a9abda9: field emoticons: %w" , err )
}
if headerLen > 0 {
e .Emoticons = make ([]string , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroup#7a9abda9: field emoticons: %w" , err )
}
e .Emoticons = append (e .Emoticons , value )
}
}
return nil
}
func (e *EmojiGroup ) GetTitle () (value string ) {
if e == nil {
return
}
return e .Title
}
func (e *EmojiGroup ) GetIconEmojiID () (value int64 ) {
if e == nil {
return
}
return e .IconEmojiID
}
func (e *EmojiGroup ) GetEmoticons () (value []string ) {
if e == nil {
return
}
return e .Emoticons
}
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 .