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 ChatAdminWithInvites struct {
AdminID int64
InvitesCount int
RevokedInvitesCount int
}
const ChatAdminWithInvitesTypeID = 0xf2ecef23
var (
_ bin .Encoder = &ChatAdminWithInvites {}
_ bin .Decoder = &ChatAdminWithInvites {}
_ bin .BareEncoder = &ChatAdminWithInvites {}
_ bin .BareDecoder = &ChatAdminWithInvites {}
)
func (c *ChatAdminWithInvites ) Zero () bool {
if c == nil {
return true
}
if !(c .AdminID == 0 ) {
return false
}
if !(c .InvitesCount == 0 ) {
return false
}
if !(c .RevokedInvitesCount == 0 ) {
return false
}
return true
}
func (c *ChatAdminWithInvites ) String () string {
if c == nil {
return "ChatAdminWithInvites(nil)"
}
type Alias ChatAdminWithInvites
return fmt .Sprintf ("ChatAdminWithInvites%+v" , Alias (*c ))
}
func (c *ChatAdminWithInvites ) FillFrom (from interface {
GetAdminID () (value int64 )
GetInvitesCount () (value int )
GetRevokedInvitesCount () (value int )
}) {
c .AdminID = from .GetAdminID ()
c .InvitesCount = from .GetInvitesCount ()
c .RevokedInvitesCount = from .GetRevokedInvitesCount ()
}
func (*ChatAdminWithInvites ) TypeID () uint32 {
return ChatAdminWithInvitesTypeID
}
func (*ChatAdminWithInvites ) TypeName () string {
return "chatAdminWithInvites"
}
func (c *ChatAdminWithInvites ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "chatAdminWithInvites" ,
ID : ChatAdminWithInvitesTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "InvitesCount" ,
SchemaName : "invites_count" ,
},
{
Name : "RevokedInvitesCount" ,
SchemaName : "revoked_invites_count" ,
},
}
return typ
}
func (c *ChatAdminWithInvites ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode chatAdminWithInvites#f2ecef23 as nil" )
}
b .PutID (ChatAdminWithInvitesTypeID )
return c .EncodeBare (b )
}
func (c *ChatAdminWithInvites ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode chatAdminWithInvites#f2ecef23 as nil" )
}
b .PutLong (c .AdminID )
b .PutInt (c .InvitesCount )
b .PutInt (c .RevokedInvitesCount )
return nil
}
func (c *ChatAdminWithInvites ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode chatAdminWithInvites#f2ecef23 to nil" )
}
if err := b .ConsumeID (ChatAdminWithInvitesTypeID ); err != nil {
return fmt .Errorf ("unable to decode chatAdminWithInvites#f2ecef23: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChatAdminWithInvites ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode chatAdminWithInvites#f2ecef23 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode chatAdminWithInvites#f2ecef23: field admin_id: %w" , err )
}
c .AdminID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode chatAdminWithInvites#f2ecef23: field invites_count: %w" , err )
}
c .InvitesCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode chatAdminWithInvites#f2ecef23: field revoked_invites_count: %w" , err )
}
c .RevokedInvitesCount = value
}
return nil
}
func (c *ChatAdminWithInvites ) GetAdminID () (value int64 ) {
if c == nil {
return
}
return c .AdminID
}
func (c *ChatAdminWithInvites ) GetInvitesCount () (value int ) {
if c == nil {
return
}
return c .InvitesCount
}
func (c *ChatAdminWithInvites ) GetRevokedInvitesCount () (value int ) {
if c == nil {
return
}
return c .RevokedInvitesCount
}
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 .