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 MessagesStickersNotModified struct {
}
const MessagesStickersNotModifiedTypeID = 0xf1749a22
func (s MessagesStickersNotModified ) construct () MessagesStickersClass { return &s }
var (
_ bin .Encoder = &MessagesStickersNotModified {}
_ bin .Decoder = &MessagesStickersNotModified {}
_ bin .BareEncoder = &MessagesStickersNotModified {}
_ bin .BareDecoder = &MessagesStickersNotModified {}
_ MessagesStickersClass = &MessagesStickersNotModified {}
)
func (s *MessagesStickersNotModified ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *MessagesStickersNotModified ) String () string {
if s == nil {
return "MessagesStickersNotModified(nil)"
}
type Alias MessagesStickersNotModified
return fmt .Sprintf ("MessagesStickersNotModified%+v" , Alias (*s ))
}
func (*MessagesStickersNotModified ) TypeID () uint32 {
return MessagesStickersNotModifiedTypeID
}
func (*MessagesStickersNotModified ) TypeName () string {
return "messages.stickersNotModified"
}
func (s *MessagesStickersNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.stickersNotModified" ,
ID : MessagesStickersNotModifiedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *MessagesStickersNotModified ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickersNotModified#f1749a22 as nil" )
}
b .PutID (MessagesStickersNotModifiedTypeID )
return s .EncodeBare (b )
}
func (s *MessagesStickersNotModified ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickersNotModified#f1749a22 as nil" )
}
return nil
}
func (s *MessagesStickersNotModified ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickersNotModified#f1749a22 to nil" )
}
if err := b .ConsumeID (MessagesStickersNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.stickersNotModified#f1749a22: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesStickersNotModified ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickersNotModified#f1749a22 to nil" )
}
return nil
}
type MessagesStickers struct {
Hash int64
Stickers []DocumentClass
}
const MessagesStickersTypeID = 0x30a6ec7e
func (s MessagesStickers ) construct () MessagesStickersClass { return &s }
var (
_ bin .Encoder = &MessagesStickers {}
_ bin .Decoder = &MessagesStickers {}
_ bin .BareEncoder = &MessagesStickers {}
_ bin .BareDecoder = &MessagesStickers {}
_ MessagesStickersClass = &MessagesStickers {}
)
func (s *MessagesStickers ) Zero () bool {
if s == nil {
return true
}
if !(s .Hash == 0 ) {
return false
}
if !(s .Stickers == nil ) {
return false
}
return true
}
func (s *MessagesStickers ) String () string {
if s == nil {
return "MessagesStickers(nil)"
}
type Alias MessagesStickers
return fmt .Sprintf ("MessagesStickers%+v" , Alias (*s ))
}
func (s *MessagesStickers ) FillFrom (from interface {
GetHash () (value int64 )
GetStickers () (value []DocumentClass )
}) {
s .Hash = from .GetHash ()
s .Stickers = from .GetStickers ()
}
func (*MessagesStickers ) TypeID () uint32 {
return MessagesStickersTypeID
}
func (*MessagesStickers ) TypeName () string {
return "messages.stickers"
}
func (s *MessagesStickers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.stickers" ,
ID : MessagesStickersTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Stickers" ,
SchemaName : "stickers" ,
},
}
return typ
}
func (s *MessagesStickers ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickers#30a6ec7e as nil" )
}
b .PutID (MessagesStickersTypeID )
return s .EncodeBare (b )
}
func (s *MessagesStickers ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickers#30a6ec7e as nil" )
}
b .PutLong (s .Hash )
b .PutVectorHeader (len (s .Stickers ))
for idx , v := range s .Stickers {
if v == nil {
return fmt .Errorf ("unable to encode messages.stickers#30a6ec7e: field stickers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.stickers#30a6ec7e: field stickers element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *MessagesStickers ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickers#30a6ec7e to nil" )
}
if err := b .ConsumeID (MessagesStickersTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.stickers#30a6ec7e: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesStickers ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickers#30a6ec7e to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.stickers#30a6ec7e: field hash: %w" , err )
}
s .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.stickers#30a6ec7e: field stickers: %w" , err )
}
if headerLen > 0 {
s .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.stickers#30a6ec7e: field stickers: %w" , err )
}
s .Stickers = append (s .Stickers , value )
}
}
return nil
}
func (s *MessagesStickers ) GetHash () (value int64 ) {
if s == nil {
return
}
return s .Hash
}
func (s *MessagesStickers ) GetStickers () (value []DocumentClass ) {
if s == nil {
return
}
return s .Stickers
}
func (s *MessagesStickers ) MapStickers () (value DocumentClassArray ) {
return DocumentClassArray (s .Stickers )
}
const MessagesStickersClassName = "messages.Stickers"
type MessagesStickersClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesStickersClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesStickers , bool )
}
func (s *MessagesStickersNotModified ) AsModified () (*MessagesStickers , bool ) {
return nil , false
}
func (s *MessagesStickers ) AsModified () (*MessagesStickers , bool ) {
return s , true
}
func DecodeMessagesStickers (buf *bin .Buffer ) (MessagesStickersClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesStickersNotModifiedTypeID :
v := MessagesStickersNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesStickersClass: %w" , err )
}
return &v , nil
case MessagesStickersTypeID :
v := MessagesStickers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesStickersClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesStickersClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesStickersBox struct {
Stickers MessagesStickersClass
}
func (b *MessagesStickersBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesStickersBox to nil" )
}
v , err := DecodeMessagesStickers (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .Stickers = v
return nil
}
func (b *MessagesStickersBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .Stickers == nil {
return fmt .Errorf ("unable to encode MessagesStickersClass as nil" )
}
return b .Stickers .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 .