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