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 MessagesEmojiGroupsNotModified struct {
}
const MessagesEmojiGroupsNotModifiedTypeID = 0x6fb4ad87
func (e MessagesEmojiGroupsNotModified ) construct () MessagesEmojiGroupsClass { return &e }
var (
_ bin .Encoder = &MessagesEmojiGroupsNotModified {}
_ bin .Decoder = &MessagesEmojiGroupsNotModified {}
_ bin .BareEncoder = &MessagesEmojiGroupsNotModified {}
_ bin .BareDecoder = &MessagesEmojiGroupsNotModified {}
_ MessagesEmojiGroupsClass = &MessagesEmojiGroupsNotModified {}
)
func (e *MessagesEmojiGroupsNotModified ) Zero () bool {
if e == nil {
return true
}
return true
}
func (e *MessagesEmojiGroupsNotModified ) String () string {
if e == nil {
return "MessagesEmojiGroupsNotModified(nil)"
}
type Alias MessagesEmojiGroupsNotModified
return fmt .Sprintf ("MessagesEmojiGroupsNotModified%+v" , Alias (*e ))
}
func (*MessagesEmojiGroupsNotModified ) TypeID () uint32 {
return MessagesEmojiGroupsNotModifiedTypeID
}
func (*MessagesEmojiGroupsNotModified ) TypeName () string {
return "messages.emojiGroupsNotModified"
}
func (e *MessagesEmojiGroupsNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.emojiGroupsNotModified" ,
ID : MessagesEmojiGroupsNotModifiedTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (e *MessagesEmojiGroupsNotModified ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.emojiGroupsNotModified#6fb4ad87 as nil" )
}
b .PutID (MessagesEmojiGroupsNotModifiedTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEmojiGroupsNotModified ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.emojiGroupsNotModified#6fb4ad87 as nil" )
}
return nil
}
func (e *MessagesEmojiGroupsNotModified ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.emojiGroupsNotModified#6fb4ad87 to nil" )
}
if err := b .ConsumeID (MessagesEmojiGroupsNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.emojiGroupsNotModified#6fb4ad87: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEmojiGroupsNotModified ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.emojiGroupsNotModified#6fb4ad87 to nil" )
}
return nil
}
type MessagesEmojiGroups struct {
Hash int
Groups []EmojiGroup
}
const MessagesEmojiGroupsTypeID = 0x881fb94b
func (e MessagesEmojiGroups ) construct () MessagesEmojiGroupsClass { return &e }
var (
_ bin .Encoder = &MessagesEmojiGroups {}
_ bin .Decoder = &MessagesEmojiGroups {}
_ bin .BareEncoder = &MessagesEmojiGroups {}
_ bin .BareDecoder = &MessagesEmojiGroups {}
_ MessagesEmojiGroupsClass = &MessagesEmojiGroups {}
)
func (e *MessagesEmojiGroups ) Zero () bool {
if e == nil {
return true
}
if !(e .Hash == 0 ) {
return false
}
if !(e .Groups == nil ) {
return false
}
return true
}
func (e *MessagesEmojiGroups ) String () string {
if e == nil {
return "MessagesEmojiGroups(nil)"
}
type Alias MessagesEmojiGroups
return fmt .Sprintf ("MessagesEmojiGroups%+v" , Alias (*e ))
}
func (e *MessagesEmojiGroups ) FillFrom (from interface {
GetHash () (value int )
GetGroups () (value []EmojiGroup )
}) {
e .Hash = from .GetHash ()
e .Groups = from .GetGroups ()
}
func (*MessagesEmojiGroups ) TypeID () uint32 {
return MessagesEmojiGroupsTypeID
}
func (*MessagesEmojiGroups ) TypeName () string {
return "messages.emojiGroups"
}
func (e *MessagesEmojiGroups ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.emojiGroups" ,
ID : MessagesEmojiGroupsTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Groups" ,
SchemaName : "groups" ,
},
}
return typ
}
func (e *MessagesEmojiGroups ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.emojiGroups#881fb94b as nil" )
}
b .PutID (MessagesEmojiGroupsTypeID )
return e .EncodeBare (b )
}
func (e *MessagesEmojiGroups ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.emojiGroups#881fb94b as nil" )
}
b .PutInt (e .Hash )
b .PutVectorHeader (len (e .Groups ))
for idx , v := range e .Groups {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.emojiGroups#881fb94b: field groups element with index %d: %w" , idx , err )
}
}
return nil
}
func (e *MessagesEmojiGroups ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.emojiGroups#881fb94b to nil" )
}
if err := b .ConsumeID (MessagesEmojiGroupsTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.emojiGroups#881fb94b: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesEmojiGroups ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.emojiGroups#881fb94b to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.emojiGroups#881fb94b: field hash: %w" , err )
}
e .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.emojiGroups#881fb94b: field groups: %w" , err )
}
if headerLen > 0 {
e .Groups = make ([]EmojiGroup , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value EmojiGroup
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.emojiGroups#881fb94b: field groups: %w" , err )
}
e .Groups = append (e .Groups , value )
}
}
return nil
}
func (e *MessagesEmojiGroups ) GetHash () (value int ) {
if e == nil {
return
}
return e .Hash
}
func (e *MessagesEmojiGroups ) GetGroups () (value []EmojiGroup ) {
if e == nil {
return
}
return e .Groups
}
const MessagesEmojiGroupsClassName = "messages.EmojiGroups"
type MessagesEmojiGroupsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesEmojiGroupsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesEmojiGroups , bool )
}
func (e *MessagesEmojiGroupsNotModified ) AsModified () (*MessagesEmojiGroups , bool ) {
return nil , false
}
func (e *MessagesEmojiGroups ) AsModified () (*MessagesEmojiGroups , bool ) {
return e , true
}
func DecodeMessagesEmojiGroups (buf *bin .Buffer ) (MessagesEmojiGroupsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesEmojiGroupsNotModifiedTypeID :
v := MessagesEmojiGroupsNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesEmojiGroupsClass: %w" , err )
}
return &v , nil
case MessagesEmojiGroupsTypeID :
v := MessagesEmojiGroups {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesEmojiGroupsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesEmojiGroupsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesEmojiGroupsBox struct {
EmojiGroups MessagesEmojiGroupsClass
}
func (b *MessagesEmojiGroupsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesEmojiGroupsBox to nil" )
}
v , err := DecodeMessagesEmojiGroups (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .EmojiGroups = v
return nil
}
func (b *MessagesEmojiGroupsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .EmojiGroups == nil {
return fmt .Errorf ("unable to encode MessagesEmojiGroupsClass as nil" )
}
return b .EmojiGroups .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 .