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 StatsGroupTopAdmin struct {
UserID int64
Deleted int
Kicked int
Banned int
}
const StatsGroupTopAdminTypeID = 0xd7584c87
var (
_ bin .Encoder = &StatsGroupTopAdmin {}
_ bin .Decoder = &StatsGroupTopAdmin {}
_ bin .BareEncoder = &StatsGroupTopAdmin {}
_ bin .BareDecoder = &StatsGroupTopAdmin {}
)
func (s *StatsGroupTopAdmin ) Zero () bool {
if s == nil {
return true
}
if !(s .UserID == 0 ) {
return false
}
if !(s .Deleted == 0 ) {
return false
}
if !(s .Kicked == 0 ) {
return false
}
if !(s .Banned == 0 ) {
return false
}
return true
}
func (s *StatsGroupTopAdmin ) String () string {
if s == nil {
return "StatsGroupTopAdmin(nil)"
}
type Alias StatsGroupTopAdmin
return fmt .Sprintf ("StatsGroupTopAdmin%+v" , Alias (*s ))
}
func (s *StatsGroupTopAdmin ) FillFrom (from interface {
GetUserID () (value int64 )
GetDeleted () (value int )
GetKicked () (value int )
GetBanned () (value int )
}) {
s .UserID = from .GetUserID ()
s .Deleted = from .GetDeleted ()
s .Kicked = from .GetKicked ()
s .Banned = from .GetBanned ()
}
func (*StatsGroupTopAdmin ) TypeID () uint32 {
return StatsGroupTopAdminTypeID
}
func (*StatsGroupTopAdmin ) TypeName () string {
return "statsGroupTopAdmin"
}
func (s *StatsGroupTopAdmin ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "statsGroupTopAdmin" ,
ID : StatsGroupTopAdminTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "Deleted" ,
SchemaName : "deleted" ,
},
{
Name : "Kicked" ,
SchemaName : "kicked" ,
},
{
Name : "Banned" ,
SchemaName : "banned" ,
},
}
return typ
}
func (s *StatsGroupTopAdmin ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode statsGroupTopAdmin#d7584c87 as nil" )
}
b .PutID (StatsGroupTopAdminTypeID )
return s .EncodeBare (b )
}
func (s *StatsGroupTopAdmin ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode statsGroupTopAdmin#d7584c87 as nil" )
}
b .PutLong (s .UserID )
b .PutInt (s .Deleted )
b .PutInt (s .Kicked )
b .PutInt (s .Banned )
return nil
}
func (s *StatsGroupTopAdmin ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode statsGroupTopAdmin#d7584c87 to nil" )
}
if err := b .ConsumeID (StatsGroupTopAdminTypeID ); err != nil {
return fmt .Errorf ("unable to decode statsGroupTopAdmin#d7584c87: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StatsGroupTopAdmin ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode statsGroupTopAdmin#d7584c87 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopAdmin#d7584c87: field user_id: %w" , err )
}
s .UserID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopAdmin#d7584c87: field deleted: %w" , err )
}
s .Deleted = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopAdmin#d7584c87: field kicked: %w" , err )
}
s .Kicked = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode statsGroupTopAdmin#d7584c87: field banned: %w" , err )
}
s .Banned = value
}
return nil
}
func (s *StatsGroupTopAdmin ) GetUserID () (value int64 ) {
if s == nil {
return
}
return s .UserID
}
func (s *StatsGroupTopAdmin ) GetDeleted () (value int ) {
if s == nil {
return
}
return s .Deleted
}
func (s *StatsGroupTopAdmin ) GetKicked () (value int ) {
if s == nil {
return
}
return s .Kicked
}
func (s *StatsGroupTopAdmin ) GetBanned () (value int ) {
if s == nil {
return
}
return s .Banned
}
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 .