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 ShareThemeBackdropsNotModified struct {
}
const ShareThemeBackdropsNotModifiedTypeID = 0x7a3f6dff
func (s ShareThemeBackdropsNotModified ) construct () ShareThemeBackdropsClass { return &s }
var (
_ bin .Encoder = &ShareThemeBackdropsNotModified {}
_ bin .Decoder = &ShareThemeBackdropsNotModified {}
_ bin .BareEncoder = &ShareThemeBackdropsNotModified {}
_ bin .BareDecoder = &ShareThemeBackdropsNotModified {}
_ ShareThemeBackdropsClass = &ShareThemeBackdropsNotModified {}
)
func (s *ShareThemeBackdropsNotModified ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *ShareThemeBackdropsNotModified ) String () string {
if s == nil {
return "ShareThemeBackdropsNotModified(nil)"
}
type Alias ShareThemeBackdropsNotModified
return fmt .Sprintf ("ShareThemeBackdropsNotModified%+v" , Alias (*s ))
}
func (*ShareThemeBackdropsNotModified ) TypeID () uint32 {
return ShareThemeBackdropsNotModifiedTypeID
}
func (*ShareThemeBackdropsNotModified ) TypeName () string {
return "shareThemeBackdropsNotModified"
}
func (s *ShareThemeBackdropsNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "shareThemeBackdropsNotModified" ,
ID : ShareThemeBackdropsNotModifiedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *ShareThemeBackdropsNotModified ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode shareThemeBackdropsNotModified#7a3f6dff as nil" )
}
b .PutID (ShareThemeBackdropsNotModifiedTypeID )
return s .EncodeBare (b )
}
func (s *ShareThemeBackdropsNotModified ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode shareThemeBackdropsNotModified#7a3f6dff as nil" )
}
return nil
}
func (s *ShareThemeBackdropsNotModified ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode shareThemeBackdropsNotModified#7a3f6dff to nil" )
}
if err := b .ConsumeID (ShareThemeBackdropsNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdropsNotModified#7a3f6dff: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ShareThemeBackdropsNotModified ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode shareThemeBackdropsNotModified#7a3f6dff to nil" )
}
return nil
}
type ShareThemeBackdrops struct {
Hash int
Backdrops []ShareThemeBackdropOption
}
const ShareThemeBackdropsTypeID = 0xaaeadce0
func (s ShareThemeBackdrops ) construct () ShareThemeBackdropsClass { return &s }
var (
_ bin .Encoder = &ShareThemeBackdrops {}
_ bin .Decoder = &ShareThemeBackdrops {}
_ bin .BareEncoder = &ShareThemeBackdrops {}
_ bin .BareDecoder = &ShareThemeBackdrops {}
_ ShareThemeBackdropsClass = &ShareThemeBackdrops {}
)
func (s *ShareThemeBackdrops ) Zero () bool {
if s == nil {
return true
}
if !(s .Hash == 0 ) {
return false
}
if !(s .Backdrops == nil ) {
return false
}
return true
}
func (s *ShareThemeBackdrops ) String () string {
if s == nil {
return "ShareThemeBackdrops(nil)"
}
type Alias ShareThemeBackdrops
return fmt .Sprintf ("ShareThemeBackdrops%+v" , Alias (*s ))
}
func (s *ShareThemeBackdrops ) FillFrom (from interface {
GetHash () (value int )
GetBackdrops () (value []ShareThemeBackdropOption )
}) {
s .Hash = from .GetHash ()
s .Backdrops = from .GetBackdrops ()
}
func (*ShareThemeBackdrops ) TypeID () uint32 {
return ShareThemeBackdropsTypeID
}
func (*ShareThemeBackdrops ) TypeName () string {
return "shareThemeBackdrops"
}
func (s *ShareThemeBackdrops ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "shareThemeBackdrops" ,
ID : ShareThemeBackdropsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Backdrops" ,
SchemaName : "backdrops" ,
},
}
return typ
}
func (s *ShareThemeBackdrops ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode shareThemeBackdrops#aaeadce0 as nil" )
}
b .PutID (ShareThemeBackdropsTypeID )
return s .EncodeBare (b )
}
func (s *ShareThemeBackdrops ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode shareThemeBackdrops#aaeadce0 as nil" )
}
b .PutInt (s .Hash )
b .PutVectorHeader (len (s .Backdrops ))
for idx , v := range s .Backdrops {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode shareThemeBackdrops#aaeadce0: field backdrops element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *ShareThemeBackdrops ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode shareThemeBackdrops#aaeadce0 to nil" )
}
if err := b .ConsumeID (ShareThemeBackdropsTypeID ); err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdrops#aaeadce0: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ShareThemeBackdrops ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode shareThemeBackdrops#aaeadce0 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdrops#aaeadce0: field hash: %w" , err )
}
s .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdrops#aaeadce0: field backdrops: %w" , err )
}
if headerLen > 0 {
s .Backdrops = make ([]ShareThemeBackdropOption , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value ShareThemeBackdropOption
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode shareThemeBackdrops#aaeadce0: field backdrops: %w" , err )
}
s .Backdrops = append (s .Backdrops , value )
}
}
return nil
}
func (s *ShareThemeBackdrops ) GetHash () (value int ) {
if s == nil {
return
}
return s .Hash
}
func (s *ShareThemeBackdrops ) GetBackdrops () (value []ShareThemeBackdropOption ) {
if s == nil {
return
}
return s .Backdrops
}
const ShareThemeBackdropsClassName = "ShareThemeBackdrops"
type ShareThemeBackdropsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () ShareThemeBackdropsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*ShareThemeBackdrops , bool )
}
func (s *ShareThemeBackdropsNotModified ) AsModified () (*ShareThemeBackdrops , bool ) {
return nil , false
}
func (s *ShareThemeBackdrops ) AsModified () (*ShareThemeBackdrops , bool ) {
return s , true
}
func DecodeShareThemeBackdrops (buf *bin .Buffer ) (ShareThemeBackdropsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case ShareThemeBackdropsNotModifiedTypeID :
v := ShareThemeBackdropsNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ShareThemeBackdropsClass: %w" , err )
}
return &v , nil
case ShareThemeBackdropsTypeID :
v := ShareThemeBackdrops {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode ShareThemeBackdropsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode ShareThemeBackdropsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type ShareThemeBackdropsBox struct {
ShareThemeBackdrops ShareThemeBackdropsClass
}
func (b *ShareThemeBackdropsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode ShareThemeBackdropsBox to nil" )
}
v , err := DecodeShareThemeBackdrops (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .ShareThemeBackdrops = v
return nil
}
func (b *ShareThemeBackdropsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .ShareThemeBackdrops == nil {
return fmt .Errorf ("unable to encode ShareThemeBackdropsClass as nil" )
}
return b .ShareThemeBackdrops .Encode (buf )
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .