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 EmojiKeywordsDifference struct {
LangCode string
FromVersion int
Version int
Keywords []EmojiKeywordClass
}
const EmojiKeywordsDifferenceTypeID = 0x5cc761bd
var (
_ bin .Encoder = &EmojiKeywordsDifference {}
_ bin .Decoder = &EmojiKeywordsDifference {}
_ bin .BareEncoder = &EmojiKeywordsDifference {}
_ bin .BareDecoder = &EmojiKeywordsDifference {}
)
func (e *EmojiKeywordsDifference ) Zero () bool {
if e == nil {
return true
}
if !(e .LangCode == "" ) {
return false
}
if !(e .FromVersion == 0 ) {
return false
}
if !(e .Version == 0 ) {
return false
}
if !(e .Keywords == nil ) {
return false
}
return true
}
func (e *EmojiKeywordsDifference ) String () string {
if e == nil {
return "EmojiKeywordsDifference(nil)"
}
type Alias EmojiKeywordsDifference
return fmt .Sprintf ("EmojiKeywordsDifference%+v" , Alias (*e ))
}
func (e *EmojiKeywordsDifference ) FillFrom (from interface {
GetLangCode () (value string )
GetFromVersion () (value int )
GetVersion () (value int )
GetKeywords () (value []EmojiKeywordClass )
}) {
e .LangCode = from .GetLangCode ()
e .FromVersion = from .GetFromVersion ()
e .Version = from .GetVersion ()
e .Keywords = from .GetKeywords ()
}
func (*EmojiKeywordsDifference ) TypeID () uint32 {
return EmojiKeywordsDifferenceTypeID
}
func (*EmojiKeywordsDifference ) TypeName () string {
return "emojiKeywordsDifference"
}
func (e *EmojiKeywordsDifference ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "emojiKeywordsDifference" ,
ID : EmojiKeywordsDifferenceTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
{
Name : "FromVersion" ,
SchemaName : "from_version" ,
},
{
Name : "Version" ,
SchemaName : "version" ,
},
{
Name : "Keywords" ,
SchemaName : "keywords" ,
},
}
return typ
}
func (e *EmojiKeywordsDifference ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiKeywordsDifference#5cc761bd as nil" )
}
b .PutID (EmojiKeywordsDifferenceTypeID )
return e .EncodeBare (b )
}
func (e *EmojiKeywordsDifference ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiKeywordsDifference#5cc761bd as nil" )
}
b .PutString (e .LangCode )
b .PutInt (e .FromVersion )
b .PutInt (e .Version )
b .PutVectorHeader (len (e .Keywords ))
for idx , v := range e .Keywords {
if v == nil {
return fmt .Errorf ("unable to encode emojiKeywordsDifference#5cc761bd: field keywords element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode emojiKeywordsDifference#5cc761bd: field keywords element with index %d: %w" , idx , err )
}
}
return nil
}
func (e *EmojiKeywordsDifference ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiKeywordsDifference#5cc761bd to nil" )
}
if err := b .ConsumeID (EmojiKeywordsDifferenceTypeID ); err != nil {
return fmt .Errorf ("unable to decode emojiKeywordsDifference#5cc761bd: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EmojiKeywordsDifference ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiKeywordsDifference#5cc761bd to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode emojiKeywordsDifference#5cc761bd: field lang_code: %w" , err )
}
e .LangCode = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode emojiKeywordsDifference#5cc761bd: field from_version: %w" , err )
}
e .FromVersion = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode emojiKeywordsDifference#5cc761bd: field version: %w" , err )
}
e .Version = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode emojiKeywordsDifference#5cc761bd: field keywords: %w" , err )
}
if headerLen > 0 {
e .Keywords = make ([]EmojiKeywordClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeEmojiKeyword (b )
if err != nil {
return fmt .Errorf ("unable to decode emojiKeywordsDifference#5cc761bd: field keywords: %w" , err )
}
e .Keywords = append (e .Keywords , value )
}
}
return nil
}
func (e *EmojiKeywordsDifference ) GetLangCode () (value string ) {
if e == nil {
return
}
return e .LangCode
}
func (e *EmojiKeywordsDifference ) GetFromVersion () (value int ) {
if e == nil {
return
}
return e .FromVersion
}
func (e *EmojiKeywordsDifference ) GetVersion () (value int ) {
if e == nil {
return
}
return e .Version
}
func (e *EmojiKeywordsDifference ) GetKeywords () (value []EmojiKeywordClass ) {
if e == nil {
return
}
return e .Keywords
}
func (e *EmojiKeywordsDifference ) MapKeywords () (value EmojiKeywordClassArray ) {
return EmojiKeywordClassArray (e .Keywords )
}
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 .