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 BotVerifierSettings struct {
Flags bin .Fields
CanModifyCustomDescription bool
Icon int64
Company string
CustomDescription string
}
const BotVerifierSettingsTypeID = 0xb0cd6617
var (
_ bin .Encoder = &BotVerifierSettings {}
_ bin .Decoder = &BotVerifierSettings {}
_ bin .BareEncoder = &BotVerifierSettings {}
_ bin .BareDecoder = &BotVerifierSettings {}
)
func (b *BotVerifierSettings ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .CanModifyCustomDescription == false ) {
return false
}
if !(b .Icon == 0 ) {
return false
}
if !(b .Company == "" ) {
return false
}
if !(b .CustomDescription == "" ) {
return false
}
return true
}
func (b *BotVerifierSettings ) String () string {
if b == nil {
return "BotVerifierSettings(nil)"
}
type Alias BotVerifierSettings
return fmt .Sprintf ("BotVerifierSettings%+v" , Alias (*b ))
}
func (b *BotVerifierSettings ) FillFrom (from interface {
GetCanModifyCustomDescription () (value bool )
GetIcon () (value int64 )
GetCompany () (value string )
GetCustomDescription () (value string , ok bool )
}) {
b .CanModifyCustomDescription = from .GetCanModifyCustomDescription ()
b .Icon = from .GetIcon ()
b .Company = from .GetCompany ()
if val , ok := from .GetCustomDescription (); ok {
b .CustomDescription = val
}
}
func (*BotVerifierSettings ) TypeID () uint32 {
return BotVerifierSettingsTypeID
}
func (*BotVerifierSettings ) TypeName () string {
return "botVerifierSettings"
}
func (b *BotVerifierSettings ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botVerifierSettings" ,
ID : BotVerifierSettingsTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "CanModifyCustomDescription" ,
SchemaName : "can_modify_custom_description" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "Icon" ,
SchemaName : "icon" ,
},
{
Name : "Company" ,
SchemaName : "company" ,
},
{
Name : "CustomDescription" ,
SchemaName : "custom_description" ,
Null : !b .Flags .Has (0 ),
},
}
return typ
}
func (b *BotVerifierSettings ) SetFlags () {
if !(b .CanModifyCustomDescription == false ) {
b .Flags .Set (1 )
}
if !(b .CustomDescription == "" ) {
b .Flags .Set (0 )
}
}
func (b *BotVerifierSettings ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botVerifierSettings#b0cd6617 as nil" )
}
buf .PutID (BotVerifierSettingsTypeID )
return b .EncodeBare (buf )
}
func (b *BotVerifierSettings ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botVerifierSettings#b0cd6617 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botVerifierSettings#b0cd6617: field flags: %w" , err )
}
buf .PutLong (b .Icon )
buf .PutString (b .Company )
if b .Flags .Has (0 ) {
buf .PutString (b .CustomDescription )
}
return nil
}
func (b *BotVerifierSettings ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botVerifierSettings#b0cd6617 to nil" )
}
if err := buf .ConsumeID (BotVerifierSettingsTypeID ); err != nil {
return fmt .Errorf ("unable to decode botVerifierSettings#b0cd6617: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotVerifierSettings ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botVerifierSettings#b0cd6617 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botVerifierSettings#b0cd6617: field flags: %w" , err )
}
}
b .CanModifyCustomDescription = b .Flags .Has (1 )
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode botVerifierSettings#b0cd6617: field icon: %w" , err )
}
b .Icon = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botVerifierSettings#b0cd6617: field company: %w" , err )
}
b .Company = value
}
if b .Flags .Has (0 ) {
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botVerifierSettings#b0cd6617: field custom_description: %w" , err )
}
b .CustomDescription = value
}
return nil
}
func (b *BotVerifierSettings ) SetCanModifyCustomDescription (value bool ) {
if value {
b .Flags .Set (1 )
b .CanModifyCustomDescription = true
} else {
b .Flags .Unset (1 )
b .CanModifyCustomDescription = false
}
}
func (b *BotVerifierSettings ) GetCanModifyCustomDescription () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (1 )
}
func (b *BotVerifierSettings ) GetIcon () (value int64 ) {
if b == nil {
return
}
return b .Icon
}
func (b *BotVerifierSettings ) GetCompany () (value string ) {
if b == nil {
return
}
return b .Company
}
func (b *BotVerifierSettings ) SetCustomDescription (value string ) {
b .Flags .Set (0 )
b .CustomDescription = value
}
func (b *BotVerifierSettings ) GetCustomDescription () (value string , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (0 ) {
return value , false
}
return b .CustomDescription , true
}
The pages are generated with Golds v0.8.4 . (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 .