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 MessagesAllStickersNotModified struct {
}
const MessagesAllStickersNotModifiedTypeID = 0xe86602c3
func (a MessagesAllStickersNotModified ) construct () MessagesAllStickersClass { return &a }
var (
_ bin .Encoder = &MessagesAllStickersNotModified {}
_ bin .Decoder = &MessagesAllStickersNotModified {}
_ bin .BareEncoder = &MessagesAllStickersNotModified {}
_ bin .BareDecoder = &MessagesAllStickersNotModified {}
_ MessagesAllStickersClass = &MessagesAllStickersNotModified {}
)
func (a *MessagesAllStickersNotModified ) Zero () bool {
if a == nil {
return true
}
return true
}
func (a *MessagesAllStickersNotModified ) String () string {
if a == nil {
return "MessagesAllStickersNotModified(nil)"
}
type Alias MessagesAllStickersNotModified
return fmt .Sprintf ("MessagesAllStickersNotModified%+v" , Alias (*a ))
}
func (*MessagesAllStickersNotModified ) TypeID () uint32 {
return MessagesAllStickersNotModifiedTypeID
}
func (*MessagesAllStickersNotModified ) TypeName () string {
return "messages.allStickersNotModified"
}
func (a *MessagesAllStickersNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.allStickersNotModified" ,
ID : MessagesAllStickersNotModifiedTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (a *MessagesAllStickersNotModified ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.allStickersNotModified#e86602c3 as nil" )
}
b .PutID (MessagesAllStickersNotModifiedTypeID )
return a .EncodeBare (b )
}
func (a *MessagesAllStickersNotModified ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.allStickersNotModified#e86602c3 as nil" )
}
return nil
}
func (a *MessagesAllStickersNotModified ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.allStickersNotModified#e86602c3 to nil" )
}
if err := b .ConsumeID (MessagesAllStickersNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.allStickersNotModified#e86602c3: %w" , err )
}
return a .DecodeBare (b )
}
func (a *MessagesAllStickersNotModified ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.allStickersNotModified#e86602c3 to nil" )
}
return nil
}
type MessagesAllStickers struct {
Hash int64
Sets []StickerSet
}
const MessagesAllStickersTypeID = 0xcdbbcebb
func (a MessagesAllStickers ) construct () MessagesAllStickersClass { return &a }
var (
_ bin .Encoder = &MessagesAllStickers {}
_ bin .Decoder = &MessagesAllStickers {}
_ bin .BareEncoder = &MessagesAllStickers {}
_ bin .BareDecoder = &MessagesAllStickers {}
_ MessagesAllStickersClass = &MessagesAllStickers {}
)
func (a *MessagesAllStickers ) Zero () bool {
if a == nil {
return true
}
if !(a .Hash == 0 ) {
return false
}
if !(a .Sets == nil ) {
return false
}
return true
}
func (a *MessagesAllStickers ) String () string {
if a == nil {
return "MessagesAllStickers(nil)"
}
type Alias MessagesAllStickers
return fmt .Sprintf ("MessagesAllStickers%+v" , Alias (*a ))
}
func (a *MessagesAllStickers ) FillFrom (from interface {
GetHash () (value int64 )
GetSets () (value []StickerSet )
}) {
a .Hash = from .GetHash ()
a .Sets = from .GetSets ()
}
func (*MessagesAllStickers ) TypeID () uint32 {
return MessagesAllStickersTypeID
}
func (*MessagesAllStickers ) TypeName () string {
return "messages.allStickers"
}
func (a *MessagesAllStickers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.allStickers" ,
ID : MessagesAllStickersTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Sets" ,
SchemaName : "sets" ,
},
}
return typ
}
func (a *MessagesAllStickers ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.allStickers#cdbbcebb as nil" )
}
b .PutID (MessagesAllStickersTypeID )
return a .EncodeBare (b )
}
func (a *MessagesAllStickers ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.allStickers#cdbbcebb as nil" )
}
b .PutLong (a .Hash )
b .PutVectorHeader (len (a .Sets ))
for idx , v := range a .Sets {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.allStickers#cdbbcebb: field sets element with index %d: %w" , idx , err )
}
}
return nil
}
func (a *MessagesAllStickers ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.allStickers#cdbbcebb to nil" )
}
if err := b .ConsumeID (MessagesAllStickersTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.allStickers#cdbbcebb: %w" , err )
}
return a .DecodeBare (b )
}
func (a *MessagesAllStickers ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.allStickers#cdbbcebb to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.allStickers#cdbbcebb: field hash: %w" , err )
}
a .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.allStickers#cdbbcebb: field sets: %w" , err )
}
if headerLen > 0 {
a .Sets = make ([]StickerSet , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value StickerSet
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.allStickers#cdbbcebb: field sets: %w" , err )
}
a .Sets = append (a .Sets , value )
}
}
return nil
}
func (a *MessagesAllStickers ) GetHash () (value int64 ) {
if a == nil {
return
}
return a .Hash
}
func (a *MessagesAllStickers ) GetSets () (value []StickerSet ) {
if a == nil {
return
}
return a .Sets
}
const MessagesAllStickersClassName = "messages.AllStickers"
type MessagesAllStickersClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesAllStickersClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesAllStickers , bool )
}
func (a *MessagesAllStickersNotModified ) AsModified () (*MessagesAllStickers , bool ) {
return nil , false
}
func (a *MessagesAllStickers ) AsModified () (*MessagesAllStickers , bool ) {
return a , true
}
func DecodeMessagesAllStickers (buf *bin .Buffer ) (MessagesAllStickersClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesAllStickersNotModifiedTypeID :
v := MessagesAllStickersNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesAllStickersClass: %w" , err )
}
return &v , nil
case MessagesAllStickersTypeID :
v := MessagesAllStickers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesAllStickersClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesAllStickersClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesAllStickersBox struct {
AllStickers MessagesAllStickersClass
}
func (b *MessagesAllStickersBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesAllStickersBox to nil" )
}
v , err := DecodeMessagesAllStickers (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .AllStickers = v
return nil
}
func (b *MessagesAllStickersBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .AllStickers == nil {
return fmt .Errorf ("unable to encode MessagesAllStickersClass as nil" )
}
return b .AllStickers .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 .