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 MessagesArchivedStickers struct {
Count int
Sets []StickerSetCoveredClass
}
const MessagesArchivedStickersTypeID = 0x4fcba9c8
var (
_ bin .Encoder = &MessagesArchivedStickers {}
_ bin .Decoder = &MessagesArchivedStickers {}
_ bin .BareEncoder = &MessagesArchivedStickers {}
_ bin .BareDecoder = &MessagesArchivedStickers {}
)
func (a *MessagesArchivedStickers ) Zero () bool {
if a == nil {
return true
}
if !(a .Count == 0 ) {
return false
}
if !(a .Sets == nil ) {
return false
}
return true
}
func (a *MessagesArchivedStickers ) String () string {
if a == nil {
return "MessagesArchivedStickers(nil)"
}
type Alias MessagesArchivedStickers
return fmt .Sprintf ("MessagesArchivedStickers%+v" , Alias (*a ))
}
func (a *MessagesArchivedStickers ) FillFrom (from interface {
GetCount () (value int )
GetSets () (value []StickerSetCoveredClass )
}) {
a .Count = from .GetCount ()
a .Sets = from .GetSets ()
}
func (*MessagesArchivedStickers ) TypeID () uint32 {
return MessagesArchivedStickersTypeID
}
func (*MessagesArchivedStickers ) TypeName () string {
return "messages.archivedStickers"
}
func (a *MessagesArchivedStickers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.archivedStickers" ,
ID : MessagesArchivedStickersTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Count" ,
SchemaName : "count" ,
},
{
Name : "Sets" ,
SchemaName : "sets" ,
},
}
return typ
}
func (a *MessagesArchivedStickers ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.archivedStickers#4fcba9c8 as nil" )
}
b .PutID (MessagesArchivedStickersTypeID )
return a .EncodeBare (b )
}
func (a *MessagesArchivedStickers ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode messages.archivedStickers#4fcba9c8 as nil" )
}
b .PutInt (a .Count )
b .PutVectorHeader (len (a .Sets ))
for idx , v := range a .Sets {
if v == nil {
return fmt .Errorf ("unable to encode messages.archivedStickers#4fcba9c8: field sets element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.archivedStickers#4fcba9c8: field sets element with index %d: %w" , idx , err )
}
}
return nil
}
func (a *MessagesArchivedStickers ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.archivedStickers#4fcba9c8 to nil" )
}
if err := b .ConsumeID (MessagesArchivedStickersTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.archivedStickers#4fcba9c8: %w" , err )
}
return a .DecodeBare (b )
}
func (a *MessagesArchivedStickers ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode messages.archivedStickers#4fcba9c8 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.archivedStickers#4fcba9c8: field count: %w" , err )
}
a .Count = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.archivedStickers#4fcba9c8: field sets: %w" , err )
}
if headerLen > 0 {
a .Sets = make ([]StickerSetCoveredClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeStickerSetCovered (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.archivedStickers#4fcba9c8: field sets: %w" , err )
}
a .Sets = append (a .Sets , value )
}
}
return nil
}
func (a *MessagesArchivedStickers ) GetCount () (value int ) {
if a == nil {
return
}
return a .Count
}
func (a *MessagesArchivedStickers ) GetSets () (value []StickerSetCoveredClass ) {
if a == nil {
return
}
return a .Sets
}
func (a *MessagesArchivedStickers ) MapSets () (value StickerSetCoveredClassArray ) {
return StickerSetCoveredClassArray (a .Sets )
}
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 .