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 AccountWallPapersNotModified struct {
}
const AccountWallPapersNotModifiedTypeID = 0x1c199183
func (w AccountWallPapersNotModified ) construct () AccountWallPapersClass { return &w }
var (
_ bin .Encoder = &AccountWallPapersNotModified {}
_ bin .Decoder = &AccountWallPapersNotModified {}
_ bin .BareEncoder = &AccountWallPapersNotModified {}
_ bin .BareDecoder = &AccountWallPapersNotModified {}
_ AccountWallPapersClass = &AccountWallPapersNotModified {}
)
func (w *AccountWallPapersNotModified ) Zero () bool {
if w == nil {
return true
}
return true
}
func (w *AccountWallPapersNotModified ) String () string {
if w == nil {
return "AccountWallPapersNotModified(nil)"
}
type Alias AccountWallPapersNotModified
return fmt .Sprintf ("AccountWallPapersNotModified%+v" , Alias (*w ))
}
func (*AccountWallPapersNotModified ) TypeID () uint32 {
return AccountWallPapersNotModifiedTypeID
}
func (*AccountWallPapersNotModified ) TypeName () string {
return "account.wallPapersNotModified"
}
func (w *AccountWallPapersNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.wallPapersNotModified" ,
ID : AccountWallPapersNotModifiedTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (w *AccountWallPapersNotModified ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode account.wallPapersNotModified#1c199183 as nil" )
}
b .PutID (AccountWallPapersNotModifiedTypeID )
return w .EncodeBare (b )
}
func (w *AccountWallPapersNotModified ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode account.wallPapersNotModified#1c199183 as nil" )
}
return nil
}
func (w *AccountWallPapersNotModified ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode account.wallPapersNotModified#1c199183 to nil" )
}
if err := b .ConsumeID (AccountWallPapersNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.wallPapersNotModified#1c199183: %w" , err )
}
return w .DecodeBare (b )
}
func (w *AccountWallPapersNotModified ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode account.wallPapersNotModified#1c199183 to nil" )
}
return nil
}
type AccountWallPapers struct {
Hash int64
Wallpapers []WallPaperClass
}
const AccountWallPapersTypeID = 0xcdc3858c
func (w AccountWallPapers ) construct () AccountWallPapersClass { return &w }
var (
_ bin .Encoder = &AccountWallPapers {}
_ bin .Decoder = &AccountWallPapers {}
_ bin .BareEncoder = &AccountWallPapers {}
_ bin .BareDecoder = &AccountWallPapers {}
_ AccountWallPapersClass = &AccountWallPapers {}
)
func (w *AccountWallPapers ) Zero () bool {
if w == nil {
return true
}
if !(w .Hash == 0 ) {
return false
}
if !(w .Wallpapers == nil ) {
return false
}
return true
}
func (w *AccountWallPapers ) String () string {
if w == nil {
return "AccountWallPapers(nil)"
}
type Alias AccountWallPapers
return fmt .Sprintf ("AccountWallPapers%+v" , Alias (*w ))
}
func (w *AccountWallPapers ) FillFrom (from interface {
GetHash () (value int64 )
GetWallpapers () (value []WallPaperClass )
}) {
w .Hash = from .GetHash ()
w .Wallpapers = from .GetWallpapers ()
}
func (*AccountWallPapers ) TypeID () uint32 {
return AccountWallPapersTypeID
}
func (*AccountWallPapers ) TypeName () string {
return "account.wallPapers"
}
func (w *AccountWallPapers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.wallPapers" ,
ID : AccountWallPapersTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Wallpapers" ,
SchemaName : "wallpapers" ,
},
}
return typ
}
func (w *AccountWallPapers ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode account.wallPapers#cdc3858c as nil" )
}
b .PutID (AccountWallPapersTypeID )
return w .EncodeBare (b )
}
func (w *AccountWallPapers ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode account.wallPapers#cdc3858c as nil" )
}
b .PutLong (w .Hash )
b .PutVectorHeader (len (w .Wallpapers ))
for idx , v := range w .Wallpapers {
if v == nil {
return fmt .Errorf ("unable to encode account.wallPapers#cdc3858c: field wallpapers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.wallPapers#cdc3858c: field wallpapers element with index %d: %w" , idx , err )
}
}
return nil
}
func (w *AccountWallPapers ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode account.wallPapers#cdc3858c to nil" )
}
if err := b .ConsumeID (AccountWallPapersTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.wallPapers#cdc3858c: %w" , err )
}
return w .DecodeBare (b )
}
func (w *AccountWallPapers ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode account.wallPapers#cdc3858c to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.wallPapers#cdc3858c: field hash: %w" , err )
}
w .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode account.wallPapers#cdc3858c: field wallpapers: %w" , err )
}
if headerLen > 0 {
w .Wallpapers = make ([]WallPaperClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeWallPaper (b )
if err != nil {
return fmt .Errorf ("unable to decode account.wallPapers#cdc3858c: field wallpapers: %w" , err )
}
w .Wallpapers = append (w .Wallpapers , value )
}
}
return nil
}
func (w *AccountWallPapers ) GetHash () (value int64 ) {
if w == nil {
return
}
return w .Hash
}
func (w *AccountWallPapers ) GetWallpapers () (value []WallPaperClass ) {
if w == nil {
return
}
return w .Wallpapers
}
func (w *AccountWallPapers ) MapWallpapers () (value WallPaperClassArray ) {
return WallPaperClassArray (w .Wallpapers )
}
const AccountWallPapersClassName = "account.WallPapers"
type AccountWallPapersClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () AccountWallPapersClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*AccountWallPapers , bool )
}
func (w *AccountWallPapersNotModified ) AsModified () (*AccountWallPapers , bool ) {
return nil , false
}
func (w *AccountWallPapers ) AsModified () (*AccountWallPapers , bool ) {
return w , true
}
func DecodeAccountWallPapers (buf *bin .Buffer ) (AccountWallPapersClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case AccountWallPapersNotModifiedTypeID :
v := AccountWallPapersNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountWallPapersClass: %w" , err )
}
return &v , nil
case AccountWallPapersTypeID :
v := AccountWallPapers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountWallPapersClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode AccountWallPapersClass: %w" , bin .NewUnexpectedID (id ))
}
}
type AccountWallPapersBox struct {
WallPapers AccountWallPapersClass
}
func (b *AccountWallPapersBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode AccountWallPapersBox to nil" )
}
v , err := DecodeAccountWallPapers (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .WallPapers = v
return nil
}
func (b *AccountWallPapersBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .WallPapers == nil {
return fmt .Errorf ("unable to encode AccountWallPapersClass as nil" )
}
return b .WallPapers .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 .