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 BaseThemeClassic struct {
}
const BaseThemeClassicTypeID = 0xc3a12462
func (b BaseThemeClassic ) construct () BaseThemeClass { return &b }
var (
_ bin .Encoder = &BaseThemeClassic {}
_ bin .Decoder = &BaseThemeClassic {}
_ bin .BareEncoder = &BaseThemeClassic {}
_ bin .BareDecoder = &BaseThemeClassic {}
_ BaseThemeClass = &BaseThemeClassic {}
)
func (b *BaseThemeClassic ) Zero () bool {
if b == nil {
return true
}
return true
}
func (b *BaseThemeClassic ) String () string {
if b == nil {
return "BaseThemeClassic(nil)"
}
type Alias BaseThemeClassic
return fmt .Sprintf ("BaseThemeClassic%+v" , Alias (*b ))
}
func (*BaseThemeClassic ) TypeID () uint32 {
return BaseThemeClassicTypeID
}
func (*BaseThemeClassic ) TypeName () string {
return "baseThemeClassic"
}
func (b *BaseThemeClassic ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "baseThemeClassic" ,
ID : BaseThemeClassicTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (b *BaseThemeClassic ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeClassic#c3a12462 as nil" )
}
buf .PutID (BaseThemeClassicTypeID )
return b .EncodeBare (buf )
}
func (b *BaseThemeClassic ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeClassic#c3a12462 as nil" )
}
return nil
}
func (b *BaseThemeClassic ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeClassic#c3a12462 to nil" )
}
if err := buf .ConsumeID (BaseThemeClassicTypeID ); err != nil {
return fmt .Errorf ("unable to decode baseThemeClassic#c3a12462: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BaseThemeClassic ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeClassic#c3a12462 to nil" )
}
return nil
}
type BaseThemeDay struct {
}
const BaseThemeDayTypeID = 0xfbd81688
func (b BaseThemeDay ) construct () BaseThemeClass { return &b }
var (
_ bin .Encoder = &BaseThemeDay {}
_ bin .Decoder = &BaseThemeDay {}
_ bin .BareEncoder = &BaseThemeDay {}
_ bin .BareDecoder = &BaseThemeDay {}
_ BaseThemeClass = &BaseThemeDay {}
)
func (b *BaseThemeDay ) Zero () bool {
if b == nil {
return true
}
return true
}
func (b *BaseThemeDay ) String () string {
if b == nil {
return "BaseThemeDay(nil)"
}
type Alias BaseThemeDay
return fmt .Sprintf ("BaseThemeDay%+v" , Alias (*b ))
}
func (*BaseThemeDay ) TypeID () uint32 {
return BaseThemeDayTypeID
}
func (*BaseThemeDay ) TypeName () string {
return "baseThemeDay"
}
func (b *BaseThemeDay ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "baseThemeDay" ,
ID : BaseThemeDayTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (b *BaseThemeDay ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeDay#fbd81688 as nil" )
}
buf .PutID (BaseThemeDayTypeID )
return b .EncodeBare (buf )
}
func (b *BaseThemeDay ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeDay#fbd81688 as nil" )
}
return nil
}
func (b *BaseThemeDay ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeDay#fbd81688 to nil" )
}
if err := buf .ConsumeID (BaseThemeDayTypeID ); err != nil {
return fmt .Errorf ("unable to decode baseThemeDay#fbd81688: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BaseThemeDay ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeDay#fbd81688 to nil" )
}
return nil
}
type BaseThemeNight struct {
}
const BaseThemeNightTypeID = 0xb7b31ea8
func (b BaseThemeNight ) construct () BaseThemeClass { return &b }
var (
_ bin .Encoder = &BaseThemeNight {}
_ bin .Decoder = &BaseThemeNight {}
_ bin .BareEncoder = &BaseThemeNight {}
_ bin .BareDecoder = &BaseThemeNight {}
_ BaseThemeClass = &BaseThemeNight {}
)
func (b *BaseThemeNight ) Zero () bool {
if b == nil {
return true
}
return true
}
func (b *BaseThemeNight ) String () string {
if b == nil {
return "BaseThemeNight(nil)"
}
type Alias BaseThemeNight
return fmt .Sprintf ("BaseThemeNight%+v" , Alias (*b ))
}
func (*BaseThemeNight ) TypeID () uint32 {
return BaseThemeNightTypeID
}
func (*BaseThemeNight ) TypeName () string {
return "baseThemeNight"
}
func (b *BaseThemeNight ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "baseThemeNight" ,
ID : BaseThemeNightTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (b *BaseThemeNight ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeNight#b7b31ea8 as nil" )
}
buf .PutID (BaseThemeNightTypeID )
return b .EncodeBare (buf )
}
func (b *BaseThemeNight ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeNight#b7b31ea8 as nil" )
}
return nil
}
func (b *BaseThemeNight ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeNight#b7b31ea8 to nil" )
}
if err := buf .ConsumeID (BaseThemeNightTypeID ); err != nil {
return fmt .Errorf ("unable to decode baseThemeNight#b7b31ea8: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BaseThemeNight ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeNight#b7b31ea8 to nil" )
}
return nil
}
type BaseThemeTinted struct {
}
const BaseThemeTintedTypeID = 0x6d5f77ee
func (b BaseThemeTinted ) construct () BaseThemeClass { return &b }
var (
_ bin .Encoder = &BaseThemeTinted {}
_ bin .Decoder = &BaseThemeTinted {}
_ bin .BareEncoder = &BaseThemeTinted {}
_ bin .BareDecoder = &BaseThemeTinted {}
_ BaseThemeClass = &BaseThemeTinted {}
)
func (b *BaseThemeTinted ) Zero () bool {
if b == nil {
return true
}
return true
}
func (b *BaseThemeTinted ) String () string {
if b == nil {
return "BaseThemeTinted(nil)"
}
type Alias BaseThemeTinted
return fmt .Sprintf ("BaseThemeTinted%+v" , Alias (*b ))
}
func (*BaseThemeTinted ) TypeID () uint32 {
return BaseThemeTintedTypeID
}
func (*BaseThemeTinted ) TypeName () string {
return "baseThemeTinted"
}
func (b *BaseThemeTinted ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "baseThemeTinted" ,
ID : BaseThemeTintedTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (b *BaseThemeTinted ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeTinted#6d5f77ee as nil" )
}
buf .PutID (BaseThemeTintedTypeID )
return b .EncodeBare (buf )
}
func (b *BaseThemeTinted ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeTinted#6d5f77ee as nil" )
}
return nil
}
func (b *BaseThemeTinted ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeTinted#6d5f77ee to nil" )
}
if err := buf .ConsumeID (BaseThemeTintedTypeID ); err != nil {
return fmt .Errorf ("unable to decode baseThemeTinted#6d5f77ee: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BaseThemeTinted ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeTinted#6d5f77ee to nil" )
}
return nil
}
type BaseThemeArctic struct {
}
const BaseThemeArcticTypeID = 0x5b11125a
func (b BaseThemeArctic ) construct () BaseThemeClass { return &b }
var (
_ bin .Encoder = &BaseThemeArctic {}
_ bin .Decoder = &BaseThemeArctic {}
_ bin .BareEncoder = &BaseThemeArctic {}
_ bin .BareDecoder = &BaseThemeArctic {}
_ BaseThemeClass = &BaseThemeArctic {}
)
func (b *BaseThemeArctic ) Zero () bool {
if b == nil {
return true
}
return true
}
func (b *BaseThemeArctic ) String () string {
if b == nil {
return "BaseThemeArctic(nil)"
}
type Alias BaseThemeArctic
return fmt .Sprintf ("BaseThemeArctic%+v" , Alias (*b ))
}
func (*BaseThemeArctic ) TypeID () uint32 {
return BaseThemeArcticTypeID
}
func (*BaseThemeArctic ) TypeName () string {
return "baseThemeArctic"
}
func (b *BaseThemeArctic ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "baseThemeArctic" ,
ID : BaseThemeArcticTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (b *BaseThemeArctic ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeArctic#5b11125a as nil" )
}
buf .PutID (BaseThemeArcticTypeID )
return b .EncodeBare (buf )
}
func (b *BaseThemeArctic ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode baseThemeArctic#5b11125a as nil" )
}
return nil
}
func (b *BaseThemeArctic ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeArctic#5b11125a to nil" )
}
if err := buf .ConsumeID (BaseThemeArcticTypeID ); err != nil {
return fmt .Errorf ("unable to decode baseThemeArctic#5b11125a: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BaseThemeArctic ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode baseThemeArctic#5b11125a to nil" )
}
return nil
}
const BaseThemeClassName = "BaseTheme"
type BaseThemeClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () BaseThemeClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeBaseTheme (buf *bin .Buffer ) (BaseThemeClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case BaseThemeClassicTypeID :
v := BaseThemeClassic {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BaseThemeClass: %w" , err )
}
return &v , nil
case BaseThemeDayTypeID :
v := BaseThemeDay {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BaseThemeClass: %w" , err )
}
return &v , nil
case BaseThemeNightTypeID :
v := BaseThemeNight {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BaseThemeClass: %w" , err )
}
return &v , nil
case BaseThemeTintedTypeID :
v := BaseThemeTinted {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BaseThemeClass: %w" , err )
}
return &v , nil
case BaseThemeArcticTypeID :
v := BaseThemeArctic {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BaseThemeClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode BaseThemeClass: %w" , bin .NewUnexpectedID (id ))
}
}
type BaseThemeBox struct {
BaseTheme BaseThemeClass
}
func (b *BaseThemeBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode BaseThemeBox to nil" )
}
v , err := DecodeBaseTheme (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .BaseTheme = v
return nil
}
func (b *BaseThemeBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .BaseTheme == nil {
return fmt .Errorf ("unable to encode BaseThemeClass as nil" )
}
return b .BaseTheme .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 .