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 MessagesRecentStickersNotModified struct {
}
const MessagesRecentStickersNotModifiedTypeID = 0xb17f890
func (r MessagesRecentStickersNotModified ) construct () MessagesRecentStickersClass { return &r }
var (
_ bin .Encoder = &MessagesRecentStickersNotModified {}
_ bin .Decoder = &MessagesRecentStickersNotModified {}
_ bin .BareEncoder = &MessagesRecentStickersNotModified {}
_ bin .BareDecoder = &MessagesRecentStickersNotModified {}
_ MessagesRecentStickersClass = &MessagesRecentStickersNotModified {}
)
func (r *MessagesRecentStickersNotModified ) Zero () bool {
if r == nil {
return true
}
return true
}
func (r *MessagesRecentStickersNotModified ) String () string {
if r == nil {
return "MessagesRecentStickersNotModified(nil)"
}
type Alias MessagesRecentStickersNotModified
return fmt .Sprintf ("MessagesRecentStickersNotModified%+v" , Alias (*r ))
}
func (*MessagesRecentStickersNotModified ) TypeID () uint32 {
return MessagesRecentStickersNotModifiedTypeID
}
func (*MessagesRecentStickersNotModified ) TypeName () string {
return "messages.recentStickersNotModified"
}
func (r *MessagesRecentStickersNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.recentStickersNotModified" ,
ID : MessagesRecentStickersNotModifiedTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (r *MessagesRecentStickersNotModified ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.recentStickersNotModified#b17f890 as nil" )
}
b .PutID (MessagesRecentStickersNotModifiedTypeID )
return r .EncodeBare (b )
}
func (r *MessagesRecentStickersNotModified ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.recentStickersNotModified#b17f890 as nil" )
}
return nil
}
func (r *MessagesRecentStickersNotModified ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.recentStickersNotModified#b17f890 to nil" )
}
if err := b .ConsumeID (MessagesRecentStickersNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.recentStickersNotModified#b17f890: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesRecentStickersNotModified ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.recentStickersNotModified#b17f890 to nil" )
}
return nil
}
type MessagesRecentStickers struct {
Hash int64
Packs []StickerPack
Stickers []DocumentClass
Dates []int
}
const MessagesRecentStickersTypeID = 0x88d37c56
func (r MessagesRecentStickers ) construct () MessagesRecentStickersClass { return &r }
var (
_ bin .Encoder = &MessagesRecentStickers {}
_ bin .Decoder = &MessagesRecentStickers {}
_ bin .BareEncoder = &MessagesRecentStickers {}
_ bin .BareDecoder = &MessagesRecentStickers {}
_ MessagesRecentStickersClass = &MessagesRecentStickers {}
)
func (r *MessagesRecentStickers ) Zero () bool {
if r == nil {
return true
}
if !(r .Hash == 0 ) {
return false
}
if !(r .Packs == nil ) {
return false
}
if !(r .Stickers == nil ) {
return false
}
if !(r .Dates == nil ) {
return false
}
return true
}
func (r *MessagesRecentStickers ) String () string {
if r == nil {
return "MessagesRecentStickers(nil)"
}
type Alias MessagesRecentStickers
return fmt .Sprintf ("MessagesRecentStickers%+v" , Alias (*r ))
}
func (r *MessagesRecentStickers ) FillFrom (from interface {
GetHash () (value int64 )
GetPacks () (value []StickerPack )
GetStickers () (value []DocumentClass )
GetDates () (value []int )
}) {
r .Hash = from .GetHash ()
r .Packs = from .GetPacks ()
r .Stickers = from .GetStickers ()
r .Dates = from .GetDates ()
}
func (*MessagesRecentStickers ) TypeID () uint32 {
return MessagesRecentStickersTypeID
}
func (*MessagesRecentStickers ) TypeName () string {
return "messages.recentStickers"
}
func (r *MessagesRecentStickers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.recentStickers" ,
ID : MessagesRecentStickersTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Packs" ,
SchemaName : "packs" ,
},
{
Name : "Stickers" ,
SchemaName : "stickers" ,
},
{
Name : "Dates" ,
SchemaName : "dates" ,
},
}
return typ
}
func (r *MessagesRecentStickers ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.recentStickers#88d37c56 as nil" )
}
b .PutID (MessagesRecentStickersTypeID )
return r .EncodeBare (b )
}
func (r *MessagesRecentStickers ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.recentStickers#88d37c56 as nil" )
}
b .PutLong (r .Hash )
b .PutVectorHeader (len (r .Packs ))
for idx , v := range r .Packs {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.recentStickers#88d37c56: field packs element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (r .Stickers ))
for idx , v := range r .Stickers {
if v == nil {
return fmt .Errorf ("unable to encode messages.recentStickers#88d37c56: field stickers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.recentStickers#88d37c56: field stickers element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (r .Dates ))
for _ , v := range r .Dates {
b .PutInt (v )
}
return nil
}
func (r *MessagesRecentStickers ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.recentStickers#88d37c56 to nil" )
}
if err := b .ConsumeID (MessagesRecentStickersTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.recentStickers#88d37c56: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesRecentStickers ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.recentStickers#88d37c56 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.recentStickers#88d37c56: field hash: %w" , err )
}
r .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.recentStickers#88d37c56: field packs: %w" , err )
}
if headerLen > 0 {
r .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.recentStickers#88d37c56: field packs: %w" , err )
}
r .Packs = append (r .Packs , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.recentStickers#88d37c56: field stickers: %w" , err )
}
if headerLen > 0 {
r .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.recentStickers#88d37c56: field stickers: %w" , err )
}
r .Stickers = append (r .Stickers , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.recentStickers#88d37c56: field dates: %w" , err )
}
if headerLen > 0 {
r .Dates = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.recentStickers#88d37c56: field dates: %w" , err )
}
r .Dates = append (r .Dates , value )
}
}
return nil
}
func (r *MessagesRecentStickers ) GetHash () (value int64 ) {
if r == nil {
return
}
return r .Hash
}
func (r *MessagesRecentStickers ) GetPacks () (value []StickerPack ) {
if r == nil {
return
}
return r .Packs
}
func (r *MessagesRecentStickers ) GetStickers () (value []DocumentClass ) {
if r == nil {
return
}
return r .Stickers
}
func (r *MessagesRecentStickers ) GetDates () (value []int ) {
if r == nil {
return
}
return r .Dates
}
func (r *MessagesRecentStickers ) MapStickers () (value DocumentClassArray ) {
return DocumentClassArray (r .Stickers )
}
const MessagesRecentStickersClassName = "messages.RecentStickers"
type MessagesRecentStickersClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesRecentStickersClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesRecentStickers , bool )
}
func (r *MessagesRecentStickersNotModified ) AsModified () (*MessagesRecentStickers , bool ) {
return nil , false
}
func (r *MessagesRecentStickers ) AsModified () (*MessagesRecentStickers , bool ) {
return r , true
}
func DecodeMessagesRecentStickers (buf *bin .Buffer ) (MessagesRecentStickersClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesRecentStickersNotModifiedTypeID :
v := MessagesRecentStickersNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesRecentStickersClass: %w" , err )
}
return &v , nil
case MessagesRecentStickersTypeID :
v := MessagesRecentStickers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesRecentStickersClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesRecentStickersClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesRecentStickersBox struct {
RecentStickers MessagesRecentStickersClass
}
func (b *MessagesRecentStickersBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesRecentStickersBox to nil" )
}
v , err := DecodeMessagesRecentStickers (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .RecentStickers = v
return nil
}
func (b *MessagesRecentStickersBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .RecentStickers == nil {
return fmt .Errorf ("unable to encode MessagesRecentStickersClass as nil" )
}
return b .RecentStickers .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 .