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 HelpAppConfigNotModified struct {
}
const HelpAppConfigNotModifiedTypeID = 0x7cde641d
func (a HelpAppConfigNotModified ) construct () HelpAppConfigClass { return &a }
var (
_ bin .Encoder = &HelpAppConfigNotModified {}
_ bin .Decoder = &HelpAppConfigNotModified {}
_ bin .BareEncoder = &HelpAppConfigNotModified {}
_ bin .BareDecoder = &HelpAppConfigNotModified {}
_ HelpAppConfigClass = &HelpAppConfigNotModified {}
)
func (a *HelpAppConfigNotModified ) Zero () bool {
if a == nil {
return true
}
return true
}
func (a *HelpAppConfigNotModified ) String () string {
if a == nil {
return "HelpAppConfigNotModified(nil)"
}
type Alias HelpAppConfigNotModified
return fmt .Sprintf ("HelpAppConfigNotModified%+v" , Alias (*a ))
}
func (*HelpAppConfigNotModified ) TypeID () uint32 {
return HelpAppConfigNotModifiedTypeID
}
func (*HelpAppConfigNotModified ) TypeName () string {
return "help.appConfigNotModified"
}
func (a *HelpAppConfigNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.appConfigNotModified" ,
ID : HelpAppConfigNotModifiedTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (a *HelpAppConfigNotModified ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode help.appConfigNotModified#7cde641d as nil" )
}
b .PutID (HelpAppConfigNotModifiedTypeID )
return a .EncodeBare (b )
}
func (a *HelpAppConfigNotModified ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode help.appConfigNotModified#7cde641d as nil" )
}
return nil
}
func (a *HelpAppConfigNotModified ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode help.appConfigNotModified#7cde641d to nil" )
}
if err := b .ConsumeID (HelpAppConfigNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.appConfigNotModified#7cde641d: %w" , err )
}
return a .DecodeBare (b )
}
func (a *HelpAppConfigNotModified ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode help.appConfigNotModified#7cde641d to nil" )
}
return nil
}
type HelpAppConfig struct {
Hash int
Config JSONValueClass
}
const HelpAppConfigTypeID = 0xdd18782e
func (a HelpAppConfig ) construct () HelpAppConfigClass { return &a }
var (
_ bin .Encoder = &HelpAppConfig {}
_ bin .Decoder = &HelpAppConfig {}
_ bin .BareEncoder = &HelpAppConfig {}
_ bin .BareDecoder = &HelpAppConfig {}
_ HelpAppConfigClass = &HelpAppConfig {}
)
func (a *HelpAppConfig ) Zero () bool {
if a == nil {
return true
}
if !(a .Hash == 0 ) {
return false
}
if !(a .Config == nil ) {
return false
}
return true
}
func (a *HelpAppConfig ) String () string {
if a == nil {
return "HelpAppConfig(nil)"
}
type Alias HelpAppConfig
return fmt .Sprintf ("HelpAppConfig%+v" , Alias (*a ))
}
func (a *HelpAppConfig ) FillFrom (from interface {
GetHash () (value int )
GetConfig () (value JSONValueClass )
}) {
a .Hash = from .GetHash ()
a .Config = from .GetConfig ()
}
func (*HelpAppConfig ) TypeID () uint32 {
return HelpAppConfigTypeID
}
func (*HelpAppConfig ) TypeName () string {
return "help.appConfig"
}
func (a *HelpAppConfig ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.appConfig" ,
ID : HelpAppConfigTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Config" ,
SchemaName : "config" ,
},
}
return typ
}
func (a *HelpAppConfig ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode help.appConfig#dd18782e as nil" )
}
b .PutID (HelpAppConfigTypeID )
return a .EncodeBare (b )
}
func (a *HelpAppConfig ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode help.appConfig#dd18782e as nil" )
}
b .PutInt (a .Hash )
if a .Config == nil {
return fmt .Errorf ("unable to encode help.appConfig#dd18782e: field config is nil" )
}
if err := a .Config .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode help.appConfig#dd18782e: field config: %w" , err )
}
return nil
}
func (a *HelpAppConfig ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode help.appConfig#dd18782e to nil" )
}
if err := b .ConsumeID (HelpAppConfigTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.appConfig#dd18782e: %w" , err )
}
return a .DecodeBare (b )
}
func (a *HelpAppConfig ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode help.appConfig#dd18782e to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode help.appConfig#dd18782e: field hash: %w" , err )
}
a .Hash = value
}
{
value , err := DecodeJSONValue (b )
if err != nil {
return fmt .Errorf ("unable to decode help.appConfig#dd18782e: field config: %w" , err )
}
a .Config = value
}
return nil
}
func (a *HelpAppConfig ) GetHash () (value int ) {
if a == nil {
return
}
return a .Hash
}
func (a *HelpAppConfig ) GetConfig () (value JSONValueClass ) {
if a == nil {
return
}
return a .Config
}
const HelpAppConfigClassName = "help.AppConfig"
type HelpAppConfigClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () HelpAppConfigClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*HelpAppConfig , bool )
}
func (a *HelpAppConfigNotModified ) AsModified () (*HelpAppConfig , bool ) {
return nil , false
}
func (a *HelpAppConfig ) AsModified () (*HelpAppConfig , bool ) {
return a , true
}
func DecodeHelpAppConfig (buf *bin .Buffer ) (HelpAppConfigClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case HelpAppConfigNotModifiedTypeID :
v := HelpAppConfigNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode HelpAppConfigClass: %w" , err )
}
return &v , nil
case HelpAppConfigTypeID :
v := HelpAppConfig {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode HelpAppConfigClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode HelpAppConfigClass: %w" , bin .NewUnexpectedID (id ))
}
}
type HelpAppConfigBox struct {
AppConfig HelpAppConfigClass
}
func (b *HelpAppConfigBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode HelpAppConfigBox to nil" )
}
v , err := DecodeHelpAppConfig (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .AppConfig = v
return nil
}
func (b *HelpAppConfigBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .AppConfig == nil {
return fmt .Errorf ("unable to encode HelpAppConfigClass as nil" )
}
return b .AppConfig .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 .