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 MessagesExportedChatInvites struct {
Count int
Invites []ExportedChatInviteClass
Users []UserClass
}
const MessagesExportedChatInvitesTypeID = 0xbdc62dcc
var (
_ bin .Encoder = &MessagesExportedChatInvites {}
_ bin .Decoder = &MessagesExportedChatInvites {}
_ bin .BareEncoder = &MessagesExportedChatInvites {}
_ bin .BareDecoder = &MessagesExportedChatInvites {}
)
func (e *MessagesExportedChatInvites ) Zero () bool {
if e == nil {
return true
}
if !(e .Count == 0 ) {
return false
}
if !(e .Invites == nil ) {
return false
}
if !(e .Users == nil ) {
return false
}
return true
}
func (e *MessagesExportedChatInvites ) String () string {
if e == nil {
return "MessagesExportedChatInvites(nil)"
}
type Alias MessagesExportedChatInvites
return fmt .Sprintf ("MessagesExportedChatInvites%+v" , Alias (*e ))
}
func (e *MessagesExportedChatInvites ) FillFrom (from interface {
GetCount () (value int )
GetInvites () (value []ExportedChatInviteClass )
GetUsers () (value []UserClass )
}) {
e .Count = from .GetCount ()
e .Invites = from .GetInvites ()
e .Users = from .GetUsers ()
}
func (*MessagesExportedChatInvites ) TypeID () uint32 {
return MessagesExportedChatInvitesTypeID
}
func (*MessagesExportedChatInvites ) TypeName () string {
return "messages.exportedChatInvites"
}
func (e *MessagesExportedChatInvites ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.exportedChatInvites" ,
ID : MessagesExportedChatInvitesTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Count" ,
SchemaName : "count" ,
},
{
Name : "Invites" ,
SchemaName : "invites" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
}
return typ
}
func (e *MessagesExportedChatInvites ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.exportedChatInvites#bdc62dcc as nil" )
}
b .PutID (MessagesExportedChatInvitesTypeID )
return e .EncodeBare (b )
}
func (e *MessagesExportedChatInvites ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode messages.exportedChatInvites#bdc62dcc as nil" )
}
b .PutInt (e .Count )
b .PutVectorHeader (len (e .Invites ))
for idx , v := range e .Invites {
if v == nil {
return fmt .Errorf ("unable to encode messages.exportedChatInvites#bdc62dcc: field invites element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.exportedChatInvites#bdc62dcc: field invites element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (e .Users ))
for idx , v := range e .Users {
if v == nil {
return fmt .Errorf ("unable to encode messages.exportedChatInvites#bdc62dcc: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.exportedChatInvites#bdc62dcc: field users element with index %d: %w" , idx , err )
}
}
return nil
}
func (e *MessagesExportedChatInvites ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.exportedChatInvites#bdc62dcc to nil" )
}
if err := b .ConsumeID (MessagesExportedChatInvitesTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.exportedChatInvites#bdc62dcc: %w" , err )
}
return e .DecodeBare (b )
}
func (e *MessagesExportedChatInvites ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode messages.exportedChatInvites#bdc62dcc to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.exportedChatInvites#bdc62dcc: field count: %w" , err )
}
e .Count = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.exportedChatInvites#bdc62dcc: field invites: %w" , err )
}
if headerLen > 0 {
e .Invites = make ([]ExportedChatInviteClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeExportedChatInvite (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.exportedChatInvites#bdc62dcc: field invites: %w" , err )
}
e .Invites = append (e .Invites , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.exportedChatInvites#bdc62dcc: field users: %w" , err )
}
if headerLen > 0 {
e .Users = make ([]UserClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.exportedChatInvites#bdc62dcc: field users: %w" , err )
}
e .Users = append (e .Users , value )
}
}
return nil
}
func (e *MessagesExportedChatInvites ) GetCount () (value int ) {
if e == nil {
return
}
return e .Count
}
func (e *MessagesExportedChatInvites ) GetInvites () (value []ExportedChatInviteClass ) {
if e == nil {
return
}
return e .Invites
}
func (e *MessagesExportedChatInvites ) GetUsers () (value []UserClass ) {
if e == nil {
return
}
return e .Users
}
func (e *MessagesExportedChatInvites ) MapInvites () (value ExportedChatInviteClassArray ) {
return ExportedChatInviteClassArray (e .Invites )
}
func (e *MessagesExportedChatInvites ) MapUsers () (value UserClassArray ) {
return UserClassArray (e .Users )
}
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 .