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 StatsGroupTopPoster struct {
UserID int64
Messages int
AvgChars int
}
const StatsGroupTopPosterTypeID = 0x9d04af9b
var (
_ bin .Encoder = &StatsGroupTopPoster {}
_ bin .Decoder = &StatsGroupTopPoster {}
_ bin .BareEncoder = &StatsGroupTopPoster {}
_ bin .BareDecoder = &StatsGroupTopPoster {}
)
func (s *StatsGroupTopPoster ) Zero () bool {
if s == nil {
return true
}
if !(s .UserID == 0 ) {
return false
}
if !(s .Messages == 0 ) {
return false
}
if !(s .AvgChars == 0 ) {
return false
}
return true
}
func (s *StatsGroupTopPoster ) String () string {
if s == nil {
return "StatsGroupTopPoster(nil)"
}
type Alias StatsGroupTopPoster
return fmt .Sprintf ("StatsGroupTopPoster%+v" , Alias (*s ))
}
func (s *StatsGroupTopPoster ) FillFrom (from interface {
GetUserID () (value int64 )
GetMessages () (value int )
GetAvgChars () (value int )
}) {
s .UserID = from .GetUserID ()
s .Messages = from .GetMessages ()
s .AvgChars = from .GetAvgChars ()
}
func (*StatsGroupTopPoster ) TypeID () uint32 {
return StatsGroupTopPosterTypeID
}
func (*StatsGroupTopPoster ) TypeName () string {
return "statsGroupTopPoster"
}
func (s *StatsGroupTopPoster ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "statsGroupTopPoster" ,
ID : StatsGroupTopPosterTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "Messages" ,
SchemaName : "messages" ,
},
{
Name : "AvgChars" ,
SchemaName : "avg_chars" ,
},
}
return typ
}
func (s *StatsGroupTopPoster ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode statsGroupTopPoster#9d04af9b as nil" )
}
b .PutID (StatsGroupTopPosterTypeID )
return s .EncodeBare (b )
}
func (s *StatsGroupTopPoster ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode statsGroupTopPoster#9d04af9b as nil" )
}
b .PutLong (s .UserID )
b .PutInt (s .Messages )
b .PutInt (s .AvgChars )
return nil
}
func (s *StatsGroupTopPoster ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode statsGroupTopPoster#9d04af9b to nil" )
}
if err := b .ConsumeID (StatsGroupTopPosterTypeID ); err != nil {
return fmt .Errorf ("unable to decode statsGroupTopPoster#9d04af9b: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StatsGroupTopPoster ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode statsGroupTopPoster#9d04af9b to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopPoster#9d04af9b: field user_id: %w" , err )
}
s .UserID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopPoster#9d04af9b: field messages: %w" , err )
}
s .Messages = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopPoster#9d04af9b: field avg_chars: %w" , err )
}
s .AvgChars = value
}
return nil
}
func (s *StatsGroupTopPoster ) GetUserID () (value int64 ) {
if s == nil {
return
}
return s .UserID
}
func (s *StatsGroupTopPoster ) GetMessages () (value int ) {
if s == nil {
return
}
return s .Messages
}
func (s *StatsGroupTopPoster ) GetAvgChars () (value int ) {
if s == nil {
return
}
return s .AvgChars
}
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 .