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 EmojiListNotModified struct {
}
const EmojiListNotModifiedTypeID = 0x481eadfa
func (e EmojiListNotModified ) construct () EmojiListClass { return &e }
var (
_ bin .Encoder = &EmojiListNotModified {}
_ bin .Decoder = &EmojiListNotModified {}
_ bin .BareEncoder = &EmojiListNotModified {}
_ bin .BareDecoder = &EmojiListNotModified {}
_ EmojiListClass = &EmojiListNotModified {}
)
func (e *EmojiListNotModified ) Zero () bool {
if e == nil {
return true
}
return true
}
func (e *EmojiListNotModified ) String () string {
if e == nil {
return "EmojiListNotModified(nil)"
}
type Alias EmojiListNotModified
return fmt .Sprintf ("EmojiListNotModified%+v" , Alias (*e ))
}
func (*EmojiListNotModified ) TypeID () uint32 {
return EmojiListNotModifiedTypeID
}
func (*EmojiListNotModified ) TypeName () string {
return "emojiListNotModified"
}
func (e *EmojiListNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "emojiListNotModified" ,
ID : EmojiListNotModifiedTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (e *EmojiListNotModified ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiListNotModified#481eadfa as nil" )
}
b .PutID (EmojiListNotModifiedTypeID )
return e .EncodeBare (b )
}
func (e *EmojiListNotModified ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiListNotModified#481eadfa as nil" )
}
return nil
}
func (e *EmojiListNotModified ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiListNotModified#481eadfa to nil" )
}
if err := b .ConsumeID (EmojiListNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode emojiListNotModified#481eadfa: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EmojiListNotModified ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiListNotModified#481eadfa to nil" )
}
return nil
}
type EmojiList struct {
Hash int64
DocumentID []int64
}
const EmojiListTypeID = 0x7a1e11d1
func (e EmojiList ) construct () EmojiListClass { return &e }
var (
_ bin .Encoder = &EmojiList {}
_ bin .Decoder = &EmojiList {}
_ bin .BareEncoder = &EmojiList {}
_ bin .BareDecoder = &EmojiList {}
_ EmojiListClass = &EmojiList {}
)
func (e *EmojiList ) Zero () bool {
if e == nil {
return true
}
if !(e .Hash == 0 ) {
return false
}
if !(e .DocumentID == nil ) {
return false
}
return true
}
func (e *EmojiList ) String () string {
if e == nil {
return "EmojiList(nil)"
}
type Alias EmojiList
return fmt .Sprintf ("EmojiList%+v" , Alias (*e ))
}
func (e *EmojiList ) FillFrom (from interface {
GetHash () (value int64 )
GetDocumentID () (value []int64 )
}) {
e .Hash = from .GetHash ()
e .DocumentID = from .GetDocumentID ()
}
func (*EmojiList ) TypeID () uint32 {
return EmojiListTypeID
}
func (*EmojiList ) TypeName () string {
return "emojiList"
}
func (e *EmojiList ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "emojiList" ,
ID : EmojiListTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "DocumentID" ,
SchemaName : "document_id" ,
},
}
return typ
}
func (e *EmojiList ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiList#7a1e11d1 as nil" )
}
b .PutID (EmojiListTypeID )
return e .EncodeBare (b )
}
func (e *EmojiList ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiList#7a1e11d1 as nil" )
}
b .PutLong (e .Hash )
b .PutVectorHeader (len (e .DocumentID ))
for _ , v := range e .DocumentID {
b .PutLong (v )
}
return nil
}
func (e *EmojiList ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiList#7a1e11d1 to nil" )
}
if err := b .ConsumeID (EmojiListTypeID ); err != nil {
return fmt .Errorf ("unable to decode emojiList#7a1e11d1: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EmojiList ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiList#7a1e11d1 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode emojiList#7a1e11d1: field hash: %w" , err )
}
e .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode emojiList#7a1e11d1: field document_id: %w" , err )
}
if headerLen > 0 {
e .DocumentID = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode emojiList#7a1e11d1: field document_id: %w" , err )
}
e .DocumentID = append (e .DocumentID , value )
}
}
return nil
}
func (e *EmojiList ) GetHash () (value int64 ) {
if e == nil {
return
}
return e .Hash
}
func (e *EmojiList ) GetDocumentID () (value []int64 ) {
if e == nil {
return
}
return e .DocumentID
}
const EmojiListClassName = "EmojiList"
type EmojiListClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () EmojiListClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*EmojiList , bool )
}
func (e *EmojiListNotModified ) AsModified () (*EmojiList , bool ) {
return nil , false
}
func (e *EmojiList ) AsModified () (*EmojiList , bool ) {
return e , true
}
func DecodeEmojiList (buf *bin .Buffer ) (EmojiListClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case EmojiListNotModifiedTypeID :
v := EmojiListNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EmojiListClass: %w" , err )
}
return &v , nil
case EmojiListTypeID :
v := EmojiList {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EmojiListClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode EmojiListClass: %w" , bin .NewUnexpectedID (id ))
}
}
type EmojiListBox struct {
EmojiList EmojiListClass
}
func (b *EmojiListBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode EmojiListBox to nil" )
}
v , err := DecodeEmojiList (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .EmojiList = v
return nil
}
func (b *EmojiListBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .EmojiList == nil {
return fmt .Errorf ("unable to encode EmojiListClass as nil" )
}
return b .EmojiList .Encode (buf )
}
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 .