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 HelpPassportConfigNotModified struct {
}
const HelpPassportConfigNotModifiedTypeID = 0xbfb9f457
func (p HelpPassportConfigNotModified ) construct () HelpPassportConfigClass { return &p }
var (
_ bin .Encoder = &HelpPassportConfigNotModified {}
_ bin .Decoder = &HelpPassportConfigNotModified {}
_ bin .BareEncoder = &HelpPassportConfigNotModified {}
_ bin .BareDecoder = &HelpPassportConfigNotModified {}
_ HelpPassportConfigClass = &HelpPassportConfigNotModified {}
)
func (p *HelpPassportConfigNotModified ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *HelpPassportConfigNotModified ) String () string {
if p == nil {
return "HelpPassportConfigNotModified(nil)"
}
type Alias HelpPassportConfigNotModified
return fmt .Sprintf ("HelpPassportConfigNotModified%+v" , Alias (*p ))
}
func (*HelpPassportConfigNotModified ) TypeID () uint32 {
return HelpPassportConfigNotModifiedTypeID
}
func (*HelpPassportConfigNotModified ) TypeName () string {
return "help.passportConfigNotModified"
}
func (p *HelpPassportConfigNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.passportConfigNotModified" ,
ID : HelpPassportConfigNotModifiedTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *HelpPassportConfigNotModified ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode help.passportConfigNotModified#bfb9f457 as nil" )
}
b .PutID (HelpPassportConfigNotModifiedTypeID )
return p .EncodeBare (b )
}
func (p *HelpPassportConfigNotModified ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode help.passportConfigNotModified#bfb9f457 as nil" )
}
return nil
}
func (p *HelpPassportConfigNotModified ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode help.passportConfigNotModified#bfb9f457 to nil" )
}
if err := b .ConsumeID (HelpPassportConfigNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.passportConfigNotModified#bfb9f457: %w" , err )
}
return p .DecodeBare (b )
}
func (p *HelpPassportConfigNotModified ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode help.passportConfigNotModified#bfb9f457 to nil" )
}
return nil
}
type HelpPassportConfig struct {
Hash int
CountriesLangs DataJSON
}
const HelpPassportConfigTypeID = 0xa098d6af
func (p HelpPassportConfig ) construct () HelpPassportConfigClass { return &p }
var (
_ bin .Encoder = &HelpPassportConfig {}
_ bin .Decoder = &HelpPassportConfig {}
_ bin .BareEncoder = &HelpPassportConfig {}
_ bin .BareDecoder = &HelpPassportConfig {}
_ HelpPassportConfigClass = &HelpPassportConfig {}
)
func (p *HelpPassportConfig ) Zero () bool {
if p == nil {
return true
}
if !(p .Hash == 0 ) {
return false
}
if !(p .CountriesLangs .Zero ()) {
return false
}
return true
}
func (p *HelpPassportConfig ) String () string {
if p == nil {
return "HelpPassportConfig(nil)"
}
type Alias HelpPassportConfig
return fmt .Sprintf ("HelpPassportConfig%+v" , Alias (*p ))
}
func (p *HelpPassportConfig ) FillFrom (from interface {
GetHash () (value int )
GetCountriesLangs () (value DataJSON )
}) {
p .Hash = from .GetHash ()
p .CountriesLangs = from .GetCountriesLangs ()
}
func (*HelpPassportConfig ) TypeID () uint32 {
return HelpPassportConfigTypeID
}
func (*HelpPassportConfig ) TypeName () string {
return "help.passportConfig"
}
func (p *HelpPassportConfig ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "help.passportConfig" ,
ID : HelpPassportConfigTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "CountriesLangs" ,
SchemaName : "countries_langs" ,
},
}
return typ
}
func (p *HelpPassportConfig ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode help.passportConfig#a098d6af as nil" )
}
b .PutID (HelpPassportConfigTypeID )
return p .EncodeBare (b )
}
func (p *HelpPassportConfig ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode help.passportConfig#a098d6af as nil" )
}
b .PutInt (p .Hash )
if err := p .CountriesLangs .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode help.passportConfig#a098d6af: field countries_langs: %w" , err )
}
return nil
}
func (p *HelpPassportConfig ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode help.passportConfig#a098d6af to nil" )
}
if err := b .ConsumeID (HelpPassportConfigTypeID ); err != nil {
return fmt .Errorf ("unable to decode help.passportConfig#a098d6af: %w" , err )
}
return p .DecodeBare (b )
}
func (p *HelpPassportConfig ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode help.passportConfig#a098d6af to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode help.passportConfig#a098d6af: field hash: %w" , err )
}
p .Hash = value
}
{
if err := p .CountriesLangs .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode help.passportConfig#a098d6af: field countries_langs: %w" , err )
}
}
return nil
}
func (p *HelpPassportConfig ) GetHash () (value int ) {
if p == nil {
return
}
return p .Hash
}
func (p *HelpPassportConfig ) GetCountriesLangs () (value DataJSON ) {
if p == nil {
return
}
return p .CountriesLangs
}
const HelpPassportConfigClassName = "help.PassportConfig"
type HelpPassportConfigClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () HelpPassportConfigClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*HelpPassportConfig , bool )
}
func (p *HelpPassportConfigNotModified ) AsModified () (*HelpPassportConfig , bool ) {
return nil , false
}
func (p *HelpPassportConfig ) AsModified () (*HelpPassportConfig , bool ) {
return p , true
}
func DecodeHelpPassportConfig (buf *bin .Buffer ) (HelpPassportConfigClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case HelpPassportConfigNotModifiedTypeID :
v := HelpPassportConfigNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode HelpPassportConfigClass: %w" , err )
}
return &v , nil
case HelpPassportConfigTypeID :
v := HelpPassportConfig {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode HelpPassportConfigClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode HelpPassportConfigClass: %w" , bin .NewUnexpectedID (id ))
}
}
type HelpPassportConfigBox struct {
PassportConfig HelpPassportConfigClass
}
func (b *HelpPassportConfigBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode HelpPassportConfigBox to nil" )
}
v , err := DecodeHelpPassportConfig (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .PassportConfig = v
return nil
}
func (b *HelpPassportConfigBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .PassportConfig == nil {
return fmt .Errorf ("unable to encode HelpPassportConfigClass as nil" )
}
return b .PassportConfig .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 .