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 BotVerification struct {
BotID int64
Icon int64
Description string
}
const BotVerificationTypeID = 0xf93cd45c
var (
_ bin .Encoder = &BotVerification {}
_ bin .Decoder = &BotVerification {}
_ bin .BareEncoder = &BotVerification {}
_ bin .BareDecoder = &BotVerification {}
)
func (b *BotVerification ) Zero () bool {
if b == nil {
return true
}
if !(b .BotID == 0 ) {
return false
}
if !(b .Icon == 0 ) {
return false
}
if !(b .Description == "" ) {
return false
}
return true
}
func (b *BotVerification ) String () string {
if b == nil {
return "BotVerification(nil)"
}
type Alias BotVerification
return fmt .Sprintf ("BotVerification%+v" , Alias (*b ))
}
func (b *BotVerification ) FillFrom (from interface {
GetBotID () (value int64 )
GetIcon () (value int64 )
GetDescription () (value string )
}) {
b .BotID = from .GetBotID ()
b .Icon = from .GetIcon ()
b .Description = from .GetDescription ()
}
func (*BotVerification ) TypeID () uint32 {
return BotVerificationTypeID
}
func (*BotVerification ) TypeName () string {
return "botVerification"
}
func (b *BotVerification ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botVerification" ,
ID : BotVerificationTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BotID" ,
SchemaName : "bot_id" ,
},
{
Name : "Icon" ,
SchemaName : "icon" ,
},
{
Name : "Description" ,
SchemaName : "description" ,
},
}
return typ
}
func (b *BotVerification ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botVerification#f93cd45c as nil" )
}
buf .PutID (BotVerificationTypeID )
return b .EncodeBare (buf )
}
func (b *BotVerification ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botVerification#f93cd45c as nil" )
}
buf .PutLong (b .BotID )
buf .PutLong (b .Icon )
buf .PutString (b .Description )
return nil
}
func (b *BotVerification ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botVerification#f93cd45c to nil" )
}
if err := buf .ConsumeID (BotVerificationTypeID ); err != nil {
return fmt .Errorf ("unable to decode botVerification#f93cd45c: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotVerification ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botVerification#f93cd45c to nil" )
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode botVerification#f93cd45c: field bot_id: %w" , err )
}
b .BotID = value
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode botVerification#f93cd45c: field icon: %w" , err )
}
b .Icon = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botVerification#f93cd45c: field description: %w" , err )
}
b .Description = value
}
return nil
}
func (b *BotVerification ) GetBotID () (value int64 ) {
if b == nil {
return
}
return b .BotID
}
func (b *BotVerification ) GetIcon () (value int64 ) {
if b == nil {
return
}
return b .Icon
}
func (b *BotVerification ) GetDescription () (value string ) {
if b == nil {
return
}
return b .Description
}
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 .