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
func (e EmojiGroup ) construct () EmojiGroupClass { return &e }
var (
_ bin .Encoder = &EmojiGroup {}
_ bin .Decoder = &EmojiGroup {}
_ bin .BareEncoder = &EmojiGroup {}
_ bin .BareDecoder = &EmojiGroup {}
_ EmojiGroupClass = &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
}
type EmojiGroupGreeting struct {
Title string
IconEmojiID int64
Emoticons []string
}
const EmojiGroupGreetingTypeID = 0x80d26cc7
func (e EmojiGroupGreeting ) construct () EmojiGroupClass { return &e }
var (
_ bin .Encoder = &EmojiGroupGreeting {}
_ bin .Decoder = &EmojiGroupGreeting {}
_ bin .BareEncoder = &EmojiGroupGreeting {}
_ bin .BareDecoder = &EmojiGroupGreeting {}
_ EmojiGroupClass = &EmojiGroupGreeting {}
)
func (e *EmojiGroupGreeting ) 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 *EmojiGroupGreeting ) String () string {
if e == nil {
return "EmojiGroupGreeting(nil)"
}
type Alias EmojiGroupGreeting
return fmt .Sprintf ("EmojiGroupGreeting%+v" , Alias (*e ))
}
func (e *EmojiGroupGreeting ) 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 (*EmojiGroupGreeting ) TypeID () uint32 {
return EmojiGroupGreetingTypeID
}
func (*EmojiGroupGreeting ) TypeName () string {
return "emojiGroupGreeting"
}
func (e *EmojiGroupGreeting ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "emojiGroupGreeting" ,
ID : EmojiGroupGreetingTypeID ,
}
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 *EmojiGroupGreeting ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiGroupGreeting#80d26cc7 as nil" )
}
b .PutID (EmojiGroupGreetingTypeID )
return e .EncodeBare (b )
}
func (e *EmojiGroupGreeting ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiGroupGreeting#80d26cc7 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 *EmojiGroupGreeting ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiGroupGreeting#80d26cc7 to nil" )
}
if err := b .ConsumeID (EmojiGroupGreetingTypeID ); err != nil {
return fmt .Errorf ("unable to decode emojiGroupGreeting#80d26cc7: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EmojiGroupGreeting ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiGroupGreeting#80d26cc7 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroupGreeting#80d26cc7: field title: %w" , err )
}
e .Title = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroupGreeting#80d26cc7: field icon_emoji_id: %w" , err )
}
e .IconEmojiID = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroupGreeting#80d26cc7: 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 emojiGroupGreeting#80d26cc7: field emoticons: %w" , err )
}
e .Emoticons = append (e .Emoticons , value )
}
}
return nil
}
func (e *EmojiGroupGreeting ) GetTitle () (value string ) {
if e == nil {
return
}
return e .Title
}
func (e *EmojiGroupGreeting ) GetIconEmojiID () (value int64 ) {
if e == nil {
return
}
return e .IconEmojiID
}
func (e *EmojiGroupGreeting ) GetEmoticons () (value []string ) {
if e == nil {
return
}
return e .Emoticons
}
type EmojiGroupPremium struct {
Title string
IconEmojiID int64
}
const EmojiGroupPremiumTypeID = 0x93bcf34
func (e EmojiGroupPremium ) construct () EmojiGroupClass { return &e }
var (
_ bin .Encoder = &EmojiGroupPremium {}
_ bin .Decoder = &EmojiGroupPremium {}
_ bin .BareEncoder = &EmojiGroupPremium {}
_ bin .BareDecoder = &EmojiGroupPremium {}
_ EmojiGroupClass = &EmojiGroupPremium {}
)
func (e *EmojiGroupPremium ) Zero () bool {
if e == nil {
return true
}
if !(e .Title == "" ) {
return false
}
if !(e .IconEmojiID == 0 ) {
return false
}
return true
}
func (e *EmojiGroupPremium ) String () string {
if e == nil {
return "EmojiGroupPremium(nil)"
}
type Alias EmojiGroupPremium
return fmt .Sprintf ("EmojiGroupPremium%+v" , Alias (*e ))
}
func (e *EmojiGroupPremium ) FillFrom (from interface {
GetTitle () (value string )
GetIconEmojiID () (value int64 )
}) {
e .Title = from .GetTitle ()
e .IconEmojiID = from .GetIconEmojiID ()
}
func (*EmojiGroupPremium ) TypeID () uint32 {
return EmojiGroupPremiumTypeID
}
func (*EmojiGroupPremium ) TypeName () string {
return "emojiGroupPremium"
}
func (e *EmojiGroupPremium ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "emojiGroupPremium" ,
ID : EmojiGroupPremiumTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "IconEmojiID" ,
SchemaName : "icon_emoji_id" ,
},
}
return typ
}
func (e *EmojiGroupPremium ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiGroupPremium#93bcf34 as nil" )
}
b .PutID (EmojiGroupPremiumTypeID )
return e .EncodeBare (b )
}
func (e *EmojiGroupPremium ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode emojiGroupPremium#93bcf34 as nil" )
}
b .PutString (e .Title )
b .PutLong (e .IconEmojiID )
return nil
}
func (e *EmojiGroupPremium ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiGroupPremium#93bcf34 to nil" )
}
if err := b .ConsumeID (EmojiGroupPremiumTypeID ); err != nil {
return fmt .Errorf ("unable to decode emojiGroupPremium#93bcf34: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EmojiGroupPremium ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode emojiGroupPremium#93bcf34 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroupPremium#93bcf34: field title: %w" , err )
}
e .Title = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode emojiGroupPremium#93bcf34: field icon_emoji_id: %w" , err )
}
e .IconEmojiID = value
}
return nil
}
func (e *EmojiGroupPremium ) GetTitle () (value string ) {
if e == nil {
return
}
return e .Title
}
func (e *EmojiGroupPremium ) GetIconEmojiID () (value int64 ) {
if e == nil {
return
}
return e .IconEmojiID
}
const EmojiGroupClassName = "EmojiGroup"
type EmojiGroupClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () EmojiGroupClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetTitle () (value string )
GetIconEmojiID () (value int64 )
}
func DecodeEmojiGroup (buf *bin .Buffer ) (EmojiGroupClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case EmojiGroupTypeID :
v := EmojiGroup {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EmojiGroupClass: %w" , err )
}
return &v , nil
case EmojiGroupGreetingTypeID :
v := EmojiGroupGreeting {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EmojiGroupClass: %w" , err )
}
return &v , nil
case EmojiGroupPremiumTypeID :
v := EmojiGroupPremium {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EmojiGroupClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode EmojiGroupClass: %w" , bin .NewUnexpectedID (id ))
}
}
type EmojiGroupBox struct {
EmojiGroup EmojiGroupClass
}
func (b *EmojiGroupBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode EmojiGroupBox to nil" )
}
v , err := DecodeEmojiGroup (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .EmojiGroup = v
return nil
}
func (b *EmojiGroupBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .EmojiGroup == nil {
return fmt .Errorf ("unable to encode EmojiGroupClass as nil" )
}
return b .EmojiGroup .Encode (buf )
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .