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 PopularContact struct {
ClientID int64
Importers int
}
const PopularContactTypeID = 0x5ce14175
var (
_ bin .Encoder = &PopularContact {}
_ bin .Decoder = &PopularContact {}
_ bin .BareEncoder = &PopularContact {}
_ bin .BareDecoder = &PopularContact {}
)
func (p *PopularContact ) Zero () bool {
if p == nil {
return true
}
if !(p .ClientID == 0 ) {
return false
}
if !(p .Importers == 0 ) {
return false
}
return true
}
func (p *PopularContact ) String () string {
if p == nil {
return "PopularContact(nil)"
}
type Alias PopularContact
return fmt .Sprintf ("PopularContact%+v" , Alias (*p ))
}
func (p *PopularContact ) FillFrom (from interface {
GetClientID () (value int64 )
GetImporters () (value int )
}) {
p .ClientID = from .GetClientID ()
p .Importers = from .GetImporters ()
}
func (*PopularContact ) TypeID () uint32 {
return PopularContactTypeID
}
func (*PopularContact ) TypeName () string {
return "popularContact"
}
func (p *PopularContact ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "popularContact" ,
ID : PopularContactTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ClientID" ,
SchemaName : "client_id" ,
},
{
Name : "Importers" ,
SchemaName : "importers" ,
},
}
return typ
}
func (p *PopularContact ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode popularContact#5ce14175 as nil" )
}
b .PutID (PopularContactTypeID )
return p .EncodeBare (b )
}
func (p *PopularContact ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode popularContact#5ce14175 as nil" )
}
b .PutLong (p .ClientID )
b .PutInt (p .Importers )
return nil
}
func (p *PopularContact ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode popularContact#5ce14175 to nil" )
}
if err := b .ConsumeID (PopularContactTypeID ); err != nil {
return fmt .Errorf ("unable to decode popularContact#5ce14175: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PopularContact ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode popularContact#5ce14175 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode popularContact#5ce14175: field client_id: %w" , err )
}
p .ClientID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode popularContact#5ce14175: field importers: %w" , err )
}
p .Importers = value
}
return nil
}
func (p *PopularContact ) GetClientID () (value int64 ) {
if p == nil {
return
}
return p .ClientID
}
func (p *PopularContact ) GetImporters () (value int ) {
if p == nil {
return
}
return p .Importers
}
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 .