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 ChatlistsChatlistUpdates struct {
MissingPeers []PeerClass
Chats []ChatClass
Users []UserClass
}
const ChatlistsChatlistUpdatesTypeID = 0x93bd878d
var (
_ bin .Encoder = &ChatlistsChatlistUpdates {}
_ bin .Decoder = &ChatlistsChatlistUpdates {}
_ bin .BareEncoder = &ChatlistsChatlistUpdates {}
_ bin .BareDecoder = &ChatlistsChatlistUpdates {}
)
func (c *ChatlistsChatlistUpdates ) Zero () bool {
if c == nil {
return true
}
if !(c .MissingPeers == nil ) {
return false
}
if !(c .Chats == nil ) {
return false
}
if !(c .Users == nil ) {
return false
}
return true
}
func (c *ChatlistsChatlistUpdates ) String () string {
if c == nil {
return "ChatlistsChatlistUpdates(nil)"
}
type Alias ChatlistsChatlistUpdates
return fmt .Sprintf ("ChatlistsChatlistUpdates%+v" , Alias (*c ))
}
func (c *ChatlistsChatlistUpdates ) FillFrom (from interface {
GetMissingPeers () (value []PeerClass )
GetChats () (value []ChatClass )
GetUsers () (value []UserClass )
}) {
c .MissingPeers = from .GetMissingPeers ()
c .Chats = from .GetChats ()
c .Users = from .GetUsers ()
}
func (*ChatlistsChatlistUpdates ) TypeID () uint32 {
return ChatlistsChatlistUpdatesTypeID
}
func (*ChatlistsChatlistUpdates ) TypeName () string {
return "chatlists.chatlistUpdates"
}
func (c *ChatlistsChatlistUpdates ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "chatlists.chatlistUpdates" ,
ID : ChatlistsChatlistUpdatesTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MissingPeers" ,
SchemaName : "missing_peers" ,
},
{
Name : "Chats" ,
SchemaName : "chats" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
}
return typ
}
func (c *ChatlistsChatlistUpdates ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode chatlists.chatlistUpdates#93bd878d as nil" )
}
b .PutID (ChatlistsChatlistUpdatesTypeID )
return c .EncodeBare (b )
}
func (c *ChatlistsChatlistUpdates ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode chatlists.chatlistUpdates#93bd878d as nil" )
}
b .PutVectorHeader (len (c .MissingPeers ))
for idx , v := range c .MissingPeers {
if v == nil {
return fmt .Errorf ("unable to encode chatlists.chatlistUpdates#93bd878d: field missing_peers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode chatlists.chatlistUpdates#93bd878d: field missing_peers element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (c .Chats ))
for idx , v := range c .Chats {
if v == nil {
return fmt .Errorf ("unable to encode chatlists.chatlistUpdates#93bd878d: field chats element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode chatlists.chatlistUpdates#93bd878d: field chats element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (c .Users ))
for idx , v := range c .Users {
if v == nil {
return fmt .Errorf ("unable to encode chatlists.chatlistUpdates#93bd878d: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode chatlists.chatlistUpdates#93bd878d: field users element with index %d: %w" , idx , err )
}
}
return nil
}
func (c *ChatlistsChatlistUpdates ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode chatlists.chatlistUpdates#93bd878d to nil" )
}
if err := b .ConsumeID (ChatlistsChatlistUpdatesTypeID ); err != nil {
return fmt .Errorf ("unable to decode chatlists.chatlistUpdates#93bd878d: %w" , err )
}
return c .DecodeBare (b )
}
func (c *ChatlistsChatlistUpdates ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode chatlists.chatlistUpdates#93bd878d to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode chatlists.chatlistUpdates#93bd878d: field missing_peers: %w" , err )
}
if headerLen > 0 {
c .MissingPeers = make ([]PeerClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode chatlists.chatlistUpdates#93bd878d: field missing_peers: %w" , err )
}
c .MissingPeers = append (c .MissingPeers , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode chatlists.chatlistUpdates#93bd878d: field chats: %w" , err )
}
if headerLen > 0 {
c .Chats = make ([]ChatClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeChat (b )
if err != nil {
return fmt .Errorf ("unable to decode chatlists.chatlistUpdates#93bd878d: field chats: %w" , err )
}
c .Chats = append (c .Chats , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode chatlists.chatlistUpdates#93bd878d: field users: %w" , err )
}
if headerLen > 0 {
c .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 chatlists.chatlistUpdates#93bd878d: field users: %w" , err )
}
c .Users = append (c .Users , value )
}
}
return nil
}
func (c *ChatlistsChatlistUpdates ) GetMissingPeers () (value []PeerClass ) {
if c == nil {
return
}
return c .MissingPeers
}
func (c *ChatlistsChatlistUpdates ) GetChats () (value []ChatClass ) {
if c == nil {
return
}
return c .Chats
}
func (c *ChatlistsChatlistUpdates ) GetUsers () (value []UserClass ) {
if c == nil {
return
}
return c .Users
}
func (c *ChatlistsChatlistUpdates ) MapMissingPeers () (value PeerClassArray ) {
return PeerClassArray (c .MissingPeers )
}
func (c *ChatlistsChatlistUpdates ) MapChats () (value ChatClassArray ) {
return ChatClassArray (c .Chats )
}
func (c *ChatlistsChatlistUpdates ) MapUsers () (value UserClassArray ) {
return UserClassArray (c .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 .