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 MessagesChatFull struct {
FullChat ChatFullClass
Chats []ChatClass
Users []UserClass
}
const MessagesChatFullTypeID = 0xe5d7d19c
var (
_ bin .Encoder = &MessagesChatFull {}
_ bin .Decoder = &MessagesChatFull {}
_ bin .BareEncoder = &MessagesChatFull {}
_ bin .BareDecoder = &MessagesChatFull {}
)
func (c *MessagesChatFull ) Zero () bool {
if c == nil {
return true
}
if !(c .FullChat == nil ) {
return false
}
if !(c .Chats == nil ) {
return false
}
if !(c .Users == nil ) {
return false
}
return true
}
func (c *MessagesChatFull ) String () string {
if c == nil {
return "MessagesChatFull(nil)"
}
type Alias MessagesChatFull
return fmt .Sprintf ("MessagesChatFull%+v" , Alias (*c ))
}
func (c *MessagesChatFull ) FillFrom (from interface {
GetFullChat () (value ChatFullClass )
GetChats () (value []ChatClass )
GetUsers () (value []UserClass )
}) {
c .FullChat = from .GetFullChat ()
c .Chats = from .GetChats ()
c .Users = from .GetUsers ()
}
func (*MessagesChatFull ) TypeID () uint32 {
return MessagesChatFullTypeID
}
func (*MessagesChatFull ) TypeName () string {
return "messages.chatFull"
}
func (c *MessagesChatFull ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.chatFull" ,
ID : MessagesChatFullTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FullChat" ,
SchemaName : "full_chat" ,
},
{
Name : "Chats" ,
SchemaName : "chats" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
}
return typ
}
func (c *MessagesChatFull ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode messages.chatFull#e5d7d19c as nil" )
}
b .PutID (MessagesChatFullTypeID )
return c .EncodeBare (b )
}
func (c *MessagesChatFull ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode messages.chatFull#e5d7d19c as nil" )
}
if c .FullChat == nil {
return fmt .Errorf ("unable to encode messages.chatFull#e5d7d19c: field full_chat is nil" )
}
if err := c .FullChat .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.chatFull#e5d7d19c: field full_chat: %w" , err )
}
b .PutVectorHeader (len (c .Chats ))
for idx , v := range c .Chats {
if v == nil {
return fmt .Errorf ("unable to encode messages.chatFull#e5d7d19c: field chats element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.chatFull#e5d7d19c: 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 messages.chatFull#e5d7d19c: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.chatFull#e5d7d19c: field users element with index %d: %w" , idx , err )
}
}
return nil
}
func (c *MessagesChatFull ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode messages.chatFull#e5d7d19c to nil" )
}
if err := b .ConsumeID (MessagesChatFullTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.chatFull#e5d7d19c: %w" , err )
}
return c .DecodeBare (b )
}
func (c *MessagesChatFull ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode messages.chatFull#e5d7d19c to nil" )
}
{
value , err := DecodeChatFull (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.chatFull#e5d7d19c: field full_chat: %w" , err )
}
c .FullChat = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.chatFull#e5d7d19c: 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 messages.chatFull#e5d7d19c: field chats: %w" , err )
}
c .Chats = append (c .Chats , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.chatFull#e5d7d19c: 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 messages.chatFull#e5d7d19c: field users: %w" , err )
}
c .Users = append (c .Users , value )
}
}
return nil
}
func (c *MessagesChatFull ) GetFullChat () (value ChatFullClass ) {
if c == nil {
return
}
return c .FullChat
}
func (c *MessagesChatFull ) GetChats () (value []ChatClass ) {
if c == nil {
return
}
return c .Chats
}
func (c *MessagesChatFull ) GetUsers () (value []UserClass ) {
if c == nil {
return
}
return c .Users
}
func (c *MessagesChatFull ) MapChats () (value ChatClassArray ) {
return ChatClassArray (c .Chats )
}
func (c *MessagesChatFull ) 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 .