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 MessagesFavedStickersNotModified struct {
}
const MessagesFavedStickersNotModifiedTypeID = 0x9e8fa6d3
func (f MessagesFavedStickersNotModified ) construct () MessagesFavedStickersClass { return &f }
var (
_ bin .Encoder = &MessagesFavedStickersNotModified {}
_ bin .Decoder = &MessagesFavedStickersNotModified {}
_ bin .BareEncoder = &MessagesFavedStickersNotModified {}
_ bin .BareDecoder = &MessagesFavedStickersNotModified {}
_ MessagesFavedStickersClass = &MessagesFavedStickersNotModified {}
)
func (f *MessagesFavedStickersNotModified ) Zero () bool {
if f == nil {
return true
}
return true
}
func (f *MessagesFavedStickersNotModified ) String () string {
if f == nil {
return "MessagesFavedStickersNotModified(nil)"
}
type Alias MessagesFavedStickersNotModified
return fmt .Sprintf ("MessagesFavedStickersNotModified%+v" , Alias (*f ))
}
func (*MessagesFavedStickersNotModified ) TypeID () uint32 {
return MessagesFavedStickersNotModifiedTypeID
}
func (*MessagesFavedStickersNotModified ) TypeName () string {
return "messages.favedStickersNotModified"
}
func (f *MessagesFavedStickersNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.favedStickersNotModified" ,
ID : MessagesFavedStickersNotModifiedTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (f *MessagesFavedStickersNotModified ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode messages.favedStickersNotModified#9e8fa6d3 as nil" )
}
b .PutID (MessagesFavedStickersNotModifiedTypeID )
return f .EncodeBare (b )
}
func (f *MessagesFavedStickersNotModified ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode messages.favedStickersNotModified#9e8fa6d3 as nil" )
}
return nil
}
func (f *MessagesFavedStickersNotModified ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode messages.favedStickersNotModified#9e8fa6d3 to nil" )
}
if err := b .ConsumeID (MessagesFavedStickersNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.favedStickersNotModified#9e8fa6d3: %w" , err )
}
return f .DecodeBare (b )
}
func (f *MessagesFavedStickersNotModified ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode messages.favedStickersNotModified#9e8fa6d3 to nil" )
}
return nil
}
type MessagesFavedStickers struct {
Hash int64
Packs []StickerPack
Stickers []DocumentClass
}
const MessagesFavedStickersTypeID = 0x2cb51097
func (f MessagesFavedStickers ) construct () MessagesFavedStickersClass { return &f }
var (
_ bin .Encoder = &MessagesFavedStickers {}
_ bin .Decoder = &MessagesFavedStickers {}
_ bin .BareEncoder = &MessagesFavedStickers {}
_ bin .BareDecoder = &MessagesFavedStickers {}
_ MessagesFavedStickersClass = &MessagesFavedStickers {}
)
func (f *MessagesFavedStickers ) Zero () bool {
if f == nil {
return true
}
if !(f .Hash == 0 ) {
return false
}
if !(f .Packs == nil ) {
return false
}
if !(f .Stickers == nil ) {
return false
}
return true
}
func (f *MessagesFavedStickers ) String () string {
if f == nil {
return "MessagesFavedStickers(nil)"
}
type Alias MessagesFavedStickers
return fmt .Sprintf ("MessagesFavedStickers%+v" , Alias (*f ))
}
func (f *MessagesFavedStickers ) FillFrom (from interface {
GetHash () (value int64 )
GetPacks () (value []StickerPack )
GetStickers () (value []DocumentClass )
}) {
f .Hash = from .GetHash ()
f .Packs = from .GetPacks ()
f .Stickers = from .GetStickers ()
}
func (*MessagesFavedStickers ) TypeID () uint32 {
return MessagesFavedStickersTypeID
}
func (*MessagesFavedStickers ) TypeName () string {
return "messages.favedStickers"
}
func (f *MessagesFavedStickers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.favedStickers" ,
ID : MessagesFavedStickersTypeID ,
}
if f == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Packs" ,
SchemaName : "packs" ,
},
{
Name : "Stickers" ,
SchemaName : "stickers" ,
},
}
return typ
}
func (f *MessagesFavedStickers ) Encode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode messages.favedStickers#2cb51097 as nil" )
}
b .PutID (MessagesFavedStickersTypeID )
return f .EncodeBare (b )
}
func (f *MessagesFavedStickers ) EncodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't encode messages.favedStickers#2cb51097 as nil" )
}
b .PutLong (f .Hash )
b .PutVectorHeader (len (f .Packs ))
for idx , v := range f .Packs {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.favedStickers#2cb51097: field packs element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (f .Stickers ))
for idx , v := range f .Stickers {
if v == nil {
return fmt .Errorf ("unable to encode messages.favedStickers#2cb51097: field stickers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.favedStickers#2cb51097: field stickers element with index %d: %w" , idx , err )
}
}
return nil
}
func (f *MessagesFavedStickers ) Decode (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode messages.favedStickers#2cb51097 to nil" )
}
if err := b .ConsumeID (MessagesFavedStickersTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.favedStickers#2cb51097: %w" , err )
}
return f .DecodeBare (b )
}
func (f *MessagesFavedStickers ) DecodeBare (b *bin .Buffer ) error {
if f == nil {
return fmt .Errorf ("can't decode messages.favedStickers#2cb51097 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.favedStickers#2cb51097: field hash: %w" , err )
}
f .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.favedStickers#2cb51097: field packs: %w" , err )
}
if headerLen > 0 {
f .Packs = make ([]StickerPack , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value StickerPack
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.favedStickers#2cb51097: field packs: %w" , err )
}
f .Packs = append (f .Packs , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.favedStickers#2cb51097: field stickers: %w" , err )
}
if headerLen > 0 {
f .Stickers = make ([]DocumentClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.favedStickers#2cb51097: field stickers: %w" , err )
}
f .Stickers = append (f .Stickers , value )
}
}
return nil
}
func (f *MessagesFavedStickers ) GetHash () (value int64 ) {
if f == nil {
return
}
return f .Hash
}
func (f *MessagesFavedStickers ) GetPacks () (value []StickerPack ) {
if f == nil {
return
}
return f .Packs
}
func (f *MessagesFavedStickers ) GetStickers () (value []DocumentClass ) {
if f == nil {
return
}
return f .Stickers
}
func (f *MessagesFavedStickers ) MapStickers () (value DocumentClassArray ) {
return DocumentClassArray (f .Stickers )
}
const MessagesFavedStickersClassName = "messages.FavedStickers"
type MessagesFavedStickersClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesFavedStickersClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesFavedStickers , bool )
}
func (f *MessagesFavedStickersNotModified ) AsModified () (*MessagesFavedStickers , bool ) {
return nil , false
}
func (f *MessagesFavedStickers ) AsModified () (*MessagesFavedStickers , bool ) {
return f , true
}
func DecodeMessagesFavedStickers (buf *bin .Buffer ) (MessagesFavedStickersClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesFavedStickersNotModifiedTypeID :
v := MessagesFavedStickersNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesFavedStickersClass: %w" , err )
}
return &v , nil
case MessagesFavedStickersTypeID :
v := MessagesFavedStickers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesFavedStickersClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesFavedStickersClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesFavedStickersBox struct {
FavedStickers MessagesFavedStickersClass
}
func (b *MessagesFavedStickersBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesFavedStickersBox to nil" )
}
v , err := DecodeMessagesFavedStickers (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .FavedStickers = v
return nil
}
func (b *MessagesFavedStickersBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .FavedStickers == nil {
return fmt .Errorf ("unable to encode MessagesFavedStickersClass as nil" )
}
return b .FavedStickers .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 .