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 MessagesStickerSetInstallResultSuccess struct {
}
const MessagesStickerSetInstallResultSuccessTypeID = 0x38641628
func (s MessagesStickerSetInstallResultSuccess ) construct () MessagesStickerSetInstallResultClass {
return &s
}
var (
_ bin .Encoder = &MessagesStickerSetInstallResultSuccess {}
_ bin .Decoder = &MessagesStickerSetInstallResultSuccess {}
_ bin .BareEncoder = &MessagesStickerSetInstallResultSuccess {}
_ bin .BareDecoder = &MessagesStickerSetInstallResultSuccess {}
_ MessagesStickerSetInstallResultClass = &MessagesStickerSetInstallResultSuccess {}
)
func (s *MessagesStickerSetInstallResultSuccess ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *MessagesStickerSetInstallResultSuccess ) String () string {
if s == nil {
return "MessagesStickerSetInstallResultSuccess(nil)"
}
type Alias MessagesStickerSetInstallResultSuccess
return fmt .Sprintf ("MessagesStickerSetInstallResultSuccess%+v" , Alias (*s ))
}
func (*MessagesStickerSetInstallResultSuccess ) TypeID () uint32 {
return MessagesStickerSetInstallResultSuccessTypeID
}
func (*MessagesStickerSetInstallResultSuccess ) TypeName () string {
return "messages.stickerSetInstallResultSuccess"
}
func (s *MessagesStickerSetInstallResultSuccess ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.stickerSetInstallResultSuccess" ,
ID : MessagesStickerSetInstallResultSuccessTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *MessagesStickerSetInstallResultSuccess ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickerSetInstallResultSuccess#38641628 as nil" )
}
b .PutID (MessagesStickerSetInstallResultSuccessTypeID )
return s .EncodeBare (b )
}
func (s *MessagesStickerSetInstallResultSuccess ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickerSetInstallResultSuccess#38641628 as nil" )
}
return nil
}
func (s *MessagesStickerSetInstallResultSuccess ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickerSetInstallResultSuccess#38641628 to nil" )
}
if err := b .ConsumeID (MessagesStickerSetInstallResultSuccessTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.stickerSetInstallResultSuccess#38641628: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesStickerSetInstallResultSuccess ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickerSetInstallResultSuccess#38641628 to nil" )
}
return nil
}
type MessagesStickerSetInstallResultArchive struct {
Sets []StickerSetCoveredClass
}
const MessagesStickerSetInstallResultArchiveTypeID = 0x35e410a8
func (s MessagesStickerSetInstallResultArchive ) construct () MessagesStickerSetInstallResultClass {
return &s
}
var (
_ bin .Encoder = &MessagesStickerSetInstallResultArchive {}
_ bin .Decoder = &MessagesStickerSetInstallResultArchive {}
_ bin .BareEncoder = &MessagesStickerSetInstallResultArchive {}
_ bin .BareDecoder = &MessagesStickerSetInstallResultArchive {}
_ MessagesStickerSetInstallResultClass = &MessagesStickerSetInstallResultArchive {}
)
func (s *MessagesStickerSetInstallResultArchive ) Zero () bool {
if s == nil {
return true
}
if !(s .Sets == nil ) {
return false
}
return true
}
func (s *MessagesStickerSetInstallResultArchive ) String () string {
if s == nil {
return "MessagesStickerSetInstallResultArchive(nil)"
}
type Alias MessagesStickerSetInstallResultArchive
return fmt .Sprintf ("MessagesStickerSetInstallResultArchive%+v" , Alias (*s ))
}
func (s *MessagesStickerSetInstallResultArchive ) FillFrom (from interface {
GetSets () (value []StickerSetCoveredClass )
}) {
s .Sets = from .GetSets ()
}
func (*MessagesStickerSetInstallResultArchive ) TypeID () uint32 {
return MessagesStickerSetInstallResultArchiveTypeID
}
func (*MessagesStickerSetInstallResultArchive ) TypeName () string {
return "messages.stickerSetInstallResultArchive"
}
func (s *MessagesStickerSetInstallResultArchive ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.stickerSetInstallResultArchive" ,
ID : MessagesStickerSetInstallResultArchiveTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Sets" ,
SchemaName : "sets" ,
},
}
return typ
}
func (s *MessagesStickerSetInstallResultArchive ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickerSetInstallResultArchive#35e410a8 as nil" )
}
b .PutID (MessagesStickerSetInstallResultArchiveTypeID )
return s .EncodeBare (b )
}
func (s *MessagesStickerSetInstallResultArchive ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.stickerSetInstallResultArchive#35e410a8 as nil" )
}
b .PutVectorHeader (len (s .Sets ))
for idx , v := range s .Sets {
if v == nil {
return fmt .Errorf ("unable to encode messages.stickerSetInstallResultArchive#35e410a8: field sets element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.stickerSetInstallResultArchive#35e410a8: field sets element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *MessagesStickerSetInstallResultArchive ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickerSetInstallResultArchive#35e410a8 to nil" )
}
if err := b .ConsumeID (MessagesStickerSetInstallResultArchiveTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.stickerSetInstallResultArchive#35e410a8: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesStickerSetInstallResultArchive ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.stickerSetInstallResultArchive#35e410a8 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.stickerSetInstallResultArchive#35e410a8: field sets: %w" , err )
}
if headerLen > 0 {
s .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.stickerSetInstallResultArchive#35e410a8: field sets: %w" , err )
}
s .Sets = append (s .Sets , value )
}
}
return nil
}
func (s *MessagesStickerSetInstallResultArchive ) GetSets () (value []StickerSetCoveredClass ) {
if s == nil {
return
}
return s .Sets
}
func (s *MessagesStickerSetInstallResultArchive ) MapSets () (value StickerSetCoveredClassArray ) {
return StickerSetCoveredClassArray (s .Sets )
}
const MessagesStickerSetInstallResultClassName = "messages.StickerSetInstallResult"
type MessagesStickerSetInstallResultClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesStickerSetInstallResultClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeMessagesStickerSetInstallResult (buf *bin .Buffer ) (MessagesStickerSetInstallResultClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesStickerSetInstallResultSuccessTypeID :
v := MessagesStickerSetInstallResultSuccess {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesStickerSetInstallResultClass: %w" , err )
}
return &v , nil
case MessagesStickerSetInstallResultArchiveTypeID :
v := MessagesStickerSetInstallResultArchive {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesStickerSetInstallResultClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesStickerSetInstallResultClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesStickerSetInstallResultBox struct {
StickerSetInstallResult MessagesStickerSetInstallResultClass
}
func (b *MessagesStickerSetInstallResultBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesStickerSetInstallResultBox to nil" )
}
v , err := DecodeMessagesStickerSetInstallResult (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .StickerSetInstallResult = v
return nil
}
func (b *MessagesStickerSetInstallResultBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .StickerSetInstallResult == nil {
return fmt .Errorf ("unable to encode MessagesStickerSetInstallResultClass as nil" )
}
return b .StickerSetInstallResult .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 .