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 UpdatesDifferenceEmpty struct {
Date int
Seq int
}
const UpdatesDifferenceEmptyTypeID = 0x5d75a138
func (d UpdatesDifferenceEmpty ) construct () UpdatesDifferenceClass { return &d }
var (
_ bin .Encoder = &UpdatesDifferenceEmpty {}
_ bin .Decoder = &UpdatesDifferenceEmpty {}
_ bin .BareEncoder = &UpdatesDifferenceEmpty {}
_ bin .BareDecoder = &UpdatesDifferenceEmpty {}
_ UpdatesDifferenceClass = &UpdatesDifferenceEmpty {}
)
func (d *UpdatesDifferenceEmpty ) Zero () bool {
if d == nil {
return true
}
if !(d .Date == 0 ) {
return false
}
if !(d .Seq == 0 ) {
return false
}
return true
}
func (d *UpdatesDifferenceEmpty ) String () string {
if d == nil {
return "UpdatesDifferenceEmpty(nil)"
}
type Alias UpdatesDifferenceEmpty
return fmt .Sprintf ("UpdatesDifferenceEmpty%+v" , Alias (*d ))
}
func (d *UpdatesDifferenceEmpty ) FillFrom (from interface {
GetDate () (value int )
GetSeq () (value int )
}) {
d .Date = from .GetDate ()
d .Seq = from .GetSeq ()
}
func (*UpdatesDifferenceEmpty ) TypeID () uint32 {
return UpdatesDifferenceEmptyTypeID
}
func (*UpdatesDifferenceEmpty ) TypeName () string {
return "updates.differenceEmpty"
}
func (d *UpdatesDifferenceEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "updates.differenceEmpty" ,
ID : UpdatesDifferenceEmptyTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "Seq" ,
SchemaName : "seq" ,
},
}
return typ
}
func (d *UpdatesDifferenceEmpty ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.differenceEmpty#5d75a138 as nil" )
}
b .PutID (UpdatesDifferenceEmptyTypeID )
return d .EncodeBare (b )
}
func (d *UpdatesDifferenceEmpty ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.differenceEmpty#5d75a138 as nil" )
}
b .PutInt (d .Date )
b .PutInt (d .Seq )
return nil
}
func (d *UpdatesDifferenceEmpty ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.differenceEmpty#5d75a138 to nil" )
}
if err := b .ConsumeID (UpdatesDifferenceEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode updates.differenceEmpty#5d75a138: %w" , err )
}
return d .DecodeBare (b )
}
func (d *UpdatesDifferenceEmpty ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.differenceEmpty#5d75a138 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceEmpty#5d75a138: field date: %w" , err )
}
d .Date = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceEmpty#5d75a138: field seq: %w" , err )
}
d .Seq = value
}
return nil
}
func (d *UpdatesDifferenceEmpty ) GetDate () (value int ) {
if d == nil {
return
}
return d .Date
}
func (d *UpdatesDifferenceEmpty ) GetSeq () (value int ) {
if d == nil {
return
}
return d .Seq
}
type UpdatesDifference struct {
NewMessages []MessageClass
NewEncryptedMessages []EncryptedMessageClass
OtherUpdates []UpdateClass
Chats []ChatClass
Users []UserClass
State UpdatesState
}
const UpdatesDifferenceTypeID = 0xf49ca0
func (d UpdatesDifference ) construct () UpdatesDifferenceClass { return &d }
var (
_ bin .Encoder = &UpdatesDifference {}
_ bin .Decoder = &UpdatesDifference {}
_ bin .BareEncoder = &UpdatesDifference {}
_ bin .BareDecoder = &UpdatesDifference {}
_ UpdatesDifferenceClass = &UpdatesDifference {}
)
func (d *UpdatesDifference ) Zero () bool {
if d == nil {
return true
}
if !(d .NewMessages == nil ) {
return false
}
if !(d .NewEncryptedMessages == nil ) {
return false
}
if !(d .OtherUpdates == nil ) {
return false
}
if !(d .Chats == nil ) {
return false
}
if !(d .Users == nil ) {
return false
}
if !(d .State .Zero ()) {
return false
}
return true
}
func (d *UpdatesDifference ) String () string {
if d == nil {
return "UpdatesDifference(nil)"
}
type Alias UpdatesDifference
return fmt .Sprintf ("UpdatesDifference%+v" , Alias (*d ))
}
func (d *UpdatesDifference ) FillFrom (from interface {
GetNewMessages () (value []MessageClass )
GetNewEncryptedMessages () (value []EncryptedMessageClass )
GetOtherUpdates () (value []UpdateClass )
GetChats () (value []ChatClass )
GetUsers () (value []UserClass )
GetState () (value UpdatesState )
}) {
d .NewMessages = from .GetNewMessages ()
d .NewEncryptedMessages = from .GetNewEncryptedMessages ()
d .OtherUpdates = from .GetOtherUpdates ()
d .Chats = from .GetChats ()
d .Users = from .GetUsers ()
d .State = from .GetState ()
}
func (*UpdatesDifference ) TypeID () uint32 {
return UpdatesDifferenceTypeID
}
func (*UpdatesDifference ) TypeName () string {
return "updates.difference"
}
func (d *UpdatesDifference ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "updates.difference" ,
ID : UpdatesDifferenceTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "NewMessages" ,
SchemaName : "new_messages" ,
},
{
Name : "NewEncryptedMessages" ,
SchemaName : "new_encrypted_messages" ,
},
{
Name : "OtherUpdates" ,
SchemaName : "other_updates" ,
},
{
Name : "Chats" ,
SchemaName : "chats" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
{
Name : "State" ,
SchemaName : "state" ,
},
}
return typ
}
func (d *UpdatesDifference ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.difference#f49ca0 as nil" )
}
b .PutID (UpdatesDifferenceTypeID )
return d .EncodeBare (b )
}
func (d *UpdatesDifference ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.difference#f49ca0 as nil" )
}
b .PutVectorHeader (len (d .NewMessages ))
for idx , v := range d .NewMessages {
if v == nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field new_messages element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field new_messages element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .NewEncryptedMessages ))
for idx , v := range d .NewEncryptedMessages {
if v == nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field new_encrypted_messages element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field new_encrypted_messages element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .OtherUpdates ))
for idx , v := range d .OtherUpdates {
if v == nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field other_updates element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field other_updates element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .Chats ))
for idx , v := range d .Chats {
if v == nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field chats element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field chats element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .Users ))
for idx , v := range d .Users {
if v == nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field users element with index %d: %w" , idx , err )
}
}
if err := d .State .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.difference#f49ca0: field state: %w" , err )
}
return nil
}
func (d *UpdatesDifference ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.difference#f49ca0 to nil" )
}
if err := b .ConsumeID (UpdatesDifferenceTypeID ); err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: %w" , err )
}
return d .DecodeBare (b )
}
func (d *UpdatesDifference ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.difference#f49ca0 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field new_messages: %w" , err )
}
if headerLen > 0 {
d .NewMessages = make ([]MessageClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field new_messages: %w" , err )
}
d .NewMessages = append (d .NewMessages , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field new_encrypted_messages: %w" , err )
}
if headerLen > 0 {
d .NewEncryptedMessages = make ([]EncryptedMessageClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeEncryptedMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field new_encrypted_messages: %w" , err )
}
d .NewEncryptedMessages = append (d .NewEncryptedMessages , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field other_updates: %w" , err )
}
if headerLen > 0 {
d .OtherUpdates = make ([]UpdateClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeUpdate (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field other_updates: %w" , err )
}
d .OtherUpdates = append (d .OtherUpdates , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field chats: %w" , err )
}
if headerLen > 0 {
d .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 updates.difference#f49ca0: field chats: %w" , err )
}
d .Chats = append (d .Chats , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field users: %w" , err )
}
if headerLen > 0 {
d .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 updates.difference#f49ca0: field users: %w" , err )
}
d .Users = append (d .Users , value )
}
}
{
if err := d .State .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode updates.difference#f49ca0: field state: %w" , err )
}
}
return nil
}
func (d *UpdatesDifference ) GetNewMessages () (value []MessageClass ) {
if d == nil {
return
}
return d .NewMessages
}
func (d *UpdatesDifference ) GetNewEncryptedMessages () (value []EncryptedMessageClass ) {
if d == nil {
return
}
return d .NewEncryptedMessages
}
func (d *UpdatesDifference ) GetOtherUpdates () (value []UpdateClass ) {
if d == nil {
return
}
return d .OtherUpdates
}
func (d *UpdatesDifference ) GetChats () (value []ChatClass ) {
if d == nil {
return
}
return d .Chats
}
func (d *UpdatesDifference ) GetUsers () (value []UserClass ) {
if d == nil {
return
}
return d .Users
}
func (d *UpdatesDifference ) GetState () (value UpdatesState ) {
if d == nil {
return
}
return d .State
}
func (d *UpdatesDifference ) MapNewMessages () (value MessageClassArray ) {
return MessageClassArray (d .NewMessages )
}
func (d *UpdatesDifference ) MapNewEncryptedMessages () (value EncryptedMessageClassArray ) {
return EncryptedMessageClassArray (d .NewEncryptedMessages )
}
func (d *UpdatesDifference ) MapOtherUpdates () (value UpdateClassArray ) {
return UpdateClassArray (d .OtherUpdates )
}
func (d *UpdatesDifference ) MapChats () (value ChatClassArray ) {
return ChatClassArray (d .Chats )
}
func (d *UpdatesDifference ) MapUsers () (value UserClassArray ) {
return UserClassArray (d .Users )
}
type UpdatesDifferenceSlice struct {
NewMessages []MessageClass
NewEncryptedMessages []EncryptedMessageClass
OtherUpdates []UpdateClass
Chats []ChatClass
Users []UserClass
IntermediateState UpdatesState
}
const UpdatesDifferenceSliceTypeID = 0xa8fb1981
func (d UpdatesDifferenceSlice ) construct () UpdatesDifferenceClass { return &d }
var (
_ bin .Encoder = &UpdatesDifferenceSlice {}
_ bin .Decoder = &UpdatesDifferenceSlice {}
_ bin .BareEncoder = &UpdatesDifferenceSlice {}
_ bin .BareDecoder = &UpdatesDifferenceSlice {}
_ UpdatesDifferenceClass = &UpdatesDifferenceSlice {}
)
func (d *UpdatesDifferenceSlice ) Zero () bool {
if d == nil {
return true
}
if !(d .NewMessages == nil ) {
return false
}
if !(d .NewEncryptedMessages == nil ) {
return false
}
if !(d .OtherUpdates == nil ) {
return false
}
if !(d .Chats == nil ) {
return false
}
if !(d .Users == nil ) {
return false
}
if !(d .IntermediateState .Zero ()) {
return false
}
return true
}
func (d *UpdatesDifferenceSlice ) String () string {
if d == nil {
return "UpdatesDifferenceSlice(nil)"
}
type Alias UpdatesDifferenceSlice
return fmt .Sprintf ("UpdatesDifferenceSlice%+v" , Alias (*d ))
}
func (d *UpdatesDifferenceSlice ) FillFrom (from interface {
GetNewMessages () (value []MessageClass )
GetNewEncryptedMessages () (value []EncryptedMessageClass )
GetOtherUpdates () (value []UpdateClass )
GetChats () (value []ChatClass )
GetUsers () (value []UserClass )
GetIntermediateState () (value UpdatesState )
}) {
d .NewMessages = from .GetNewMessages ()
d .NewEncryptedMessages = from .GetNewEncryptedMessages ()
d .OtherUpdates = from .GetOtherUpdates ()
d .Chats = from .GetChats ()
d .Users = from .GetUsers ()
d .IntermediateState = from .GetIntermediateState ()
}
func (*UpdatesDifferenceSlice ) TypeID () uint32 {
return UpdatesDifferenceSliceTypeID
}
func (*UpdatesDifferenceSlice ) TypeName () string {
return "updates.differenceSlice"
}
func (d *UpdatesDifferenceSlice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "updates.differenceSlice" ,
ID : UpdatesDifferenceSliceTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "NewMessages" ,
SchemaName : "new_messages" ,
},
{
Name : "NewEncryptedMessages" ,
SchemaName : "new_encrypted_messages" ,
},
{
Name : "OtherUpdates" ,
SchemaName : "other_updates" ,
},
{
Name : "Chats" ,
SchemaName : "chats" ,
},
{
Name : "Users" ,
SchemaName : "users" ,
},
{
Name : "IntermediateState" ,
SchemaName : "intermediate_state" ,
},
}
return typ
}
func (d *UpdatesDifferenceSlice ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.differenceSlice#a8fb1981 as nil" )
}
b .PutID (UpdatesDifferenceSliceTypeID )
return d .EncodeBare (b )
}
func (d *UpdatesDifferenceSlice ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.differenceSlice#a8fb1981 as nil" )
}
b .PutVectorHeader (len (d .NewMessages ))
for idx , v := range d .NewMessages {
if v == nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field new_messages element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field new_messages element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .NewEncryptedMessages ))
for idx , v := range d .NewEncryptedMessages {
if v == nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field new_encrypted_messages element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field new_encrypted_messages element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .OtherUpdates ))
for idx , v := range d .OtherUpdates {
if v == nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field other_updates element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field other_updates element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .Chats ))
for idx , v := range d .Chats {
if v == nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field chats element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field chats element with index %d: %w" , idx , err )
}
}
b .PutVectorHeader (len (d .Users ))
for idx , v := range d .Users {
if v == nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field users element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field users element with index %d: %w" , idx , err )
}
}
if err := d .IntermediateState .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode updates.differenceSlice#a8fb1981: field intermediate_state: %w" , err )
}
return nil
}
func (d *UpdatesDifferenceSlice ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.differenceSlice#a8fb1981 to nil" )
}
if err := b .ConsumeID (UpdatesDifferenceSliceTypeID ); err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: %w" , err )
}
return d .DecodeBare (b )
}
func (d *UpdatesDifferenceSlice ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.differenceSlice#a8fb1981 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field new_messages: %w" , err )
}
if headerLen > 0 {
d .NewMessages = make ([]MessageClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field new_messages: %w" , err )
}
d .NewMessages = append (d .NewMessages , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field new_encrypted_messages: %w" , err )
}
if headerLen > 0 {
d .NewEncryptedMessages = make ([]EncryptedMessageClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeEncryptedMessage (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field new_encrypted_messages: %w" , err )
}
d .NewEncryptedMessages = append (d .NewEncryptedMessages , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field other_updates: %w" , err )
}
if headerLen > 0 {
d .OtherUpdates = make ([]UpdateClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeUpdate (b )
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field other_updates: %w" , err )
}
d .OtherUpdates = append (d .OtherUpdates , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field chats: %w" , err )
}
if headerLen > 0 {
d .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 updates.differenceSlice#a8fb1981: field chats: %w" , err )
}
d .Chats = append (d .Chats , value )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field users: %w" , err )
}
if headerLen > 0 {
d .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 updates.differenceSlice#a8fb1981: field users: %w" , err )
}
d .Users = append (d .Users , value )
}
}
{
if err := d .IntermediateState .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode updates.differenceSlice#a8fb1981: field intermediate_state: %w" , err )
}
}
return nil
}
func (d *UpdatesDifferenceSlice ) GetNewMessages () (value []MessageClass ) {
if d == nil {
return
}
return d .NewMessages
}
func (d *UpdatesDifferenceSlice ) GetNewEncryptedMessages () (value []EncryptedMessageClass ) {
if d == nil {
return
}
return d .NewEncryptedMessages
}
func (d *UpdatesDifferenceSlice ) GetOtherUpdates () (value []UpdateClass ) {
if d == nil {
return
}
return d .OtherUpdates
}
func (d *UpdatesDifferenceSlice ) GetChats () (value []ChatClass ) {
if d == nil {
return
}
return d .Chats
}
func (d *UpdatesDifferenceSlice ) GetUsers () (value []UserClass ) {
if d == nil {
return
}
return d .Users
}
func (d *UpdatesDifferenceSlice ) GetIntermediateState () (value UpdatesState ) {
if d == nil {
return
}
return d .IntermediateState
}
func (d *UpdatesDifferenceSlice ) MapNewMessages () (value MessageClassArray ) {
return MessageClassArray (d .NewMessages )
}
func (d *UpdatesDifferenceSlice ) MapNewEncryptedMessages () (value EncryptedMessageClassArray ) {
return EncryptedMessageClassArray (d .NewEncryptedMessages )
}
func (d *UpdatesDifferenceSlice ) MapOtherUpdates () (value UpdateClassArray ) {
return UpdateClassArray (d .OtherUpdates )
}
func (d *UpdatesDifferenceSlice ) MapChats () (value ChatClassArray ) {
return ChatClassArray (d .Chats )
}
func (d *UpdatesDifferenceSlice ) MapUsers () (value UserClassArray ) {
return UserClassArray (d .Users )
}
type UpdatesDifferenceTooLong struct {
Pts int
}
const UpdatesDifferenceTooLongTypeID = 0x4afe8f6d
func (d UpdatesDifferenceTooLong ) construct () UpdatesDifferenceClass { return &d }
var (
_ bin .Encoder = &UpdatesDifferenceTooLong {}
_ bin .Decoder = &UpdatesDifferenceTooLong {}
_ bin .BareEncoder = &UpdatesDifferenceTooLong {}
_ bin .BareDecoder = &UpdatesDifferenceTooLong {}
_ UpdatesDifferenceClass = &UpdatesDifferenceTooLong {}
)
func (d *UpdatesDifferenceTooLong ) Zero () bool {
if d == nil {
return true
}
if !(d .Pts == 0 ) {
return false
}
return true
}
func (d *UpdatesDifferenceTooLong ) String () string {
if d == nil {
return "UpdatesDifferenceTooLong(nil)"
}
type Alias UpdatesDifferenceTooLong
return fmt .Sprintf ("UpdatesDifferenceTooLong%+v" , Alias (*d ))
}
func (d *UpdatesDifferenceTooLong ) FillFrom (from interface {
GetPts () (value int )
}) {
d .Pts = from .GetPts ()
}
func (*UpdatesDifferenceTooLong ) TypeID () uint32 {
return UpdatesDifferenceTooLongTypeID
}
func (*UpdatesDifferenceTooLong ) TypeName () string {
return "updates.differenceTooLong"
}
func (d *UpdatesDifferenceTooLong ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "updates.differenceTooLong" ,
ID : UpdatesDifferenceTooLongTypeID ,
}
if d == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pts" ,
SchemaName : "pts" ,
},
}
return typ
}
func (d *UpdatesDifferenceTooLong ) Encode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.differenceTooLong#4afe8f6d as nil" )
}
b .PutID (UpdatesDifferenceTooLongTypeID )
return d .EncodeBare (b )
}
func (d *UpdatesDifferenceTooLong ) EncodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't encode updates.differenceTooLong#4afe8f6d as nil" )
}
b .PutInt (d .Pts )
return nil
}
func (d *UpdatesDifferenceTooLong ) Decode (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.differenceTooLong#4afe8f6d to nil" )
}
if err := b .ConsumeID (UpdatesDifferenceTooLongTypeID ); err != nil {
return fmt .Errorf ("unable to decode updates.differenceTooLong#4afe8f6d: %w" , err )
}
return d .DecodeBare (b )
}
func (d *UpdatesDifferenceTooLong ) DecodeBare (b *bin .Buffer ) error {
if d == nil {
return fmt .Errorf ("can't decode updates.differenceTooLong#4afe8f6d to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode updates.differenceTooLong#4afe8f6d: field pts: %w" , err )
}
d .Pts = value
}
return nil
}
func (d *UpdatesDifferenceTooLong ) GetPts () (value int ) {
if d == nil {
return
}
return d .Pts
}
const UpdatesDifferenceClassName = "updates.Difference"
type UpdatesDifferenceClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () UpdatesDifferenceClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeUpdatesDifference (buf *bin .Buffer ) (UpdatesDifferenceClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case UpdatesDifferenceEmptyTypeID :
v := UpdatesDifferenceEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode UpdatesDifferenceClass: %w" , err )
}
return &v , nil
case UpdatesDifferenceTypeID :
v := UpdatesDifference {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode UpdatesDifferenceClass: %w" , err )
}
return &v , nil
case UpdatesDifferenceSliceTypeID :
v := UpdatesDifferenceSlice {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode UpdatesDifferenceClass: %w" , err )
}
return &v , nil
case UpdatesDifferenceTooLongTypeID :
v := UpdatesDifferenceTooLong {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode UpdatesDifferenceClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode UpdatesDifferenceClass: %w" , bin .NewUnexpectedID (id ))
}
}
type UpdatesDifferenceBox struct {
Difference UpdatesDifferenceClass
}
func (b *UpdatesDifferenceBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode UpdatesDifferenceBox to nil" )
}
v , err := DecodeUpdatesDifference (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .Difference = v
return nil
}
func (b *UpdatesDifferenceBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .Difference == nil {
return fmt .Errorf ("unable to encode UpdatesDifferenceClass as nil" )
}
return b .Difference .Encode (buf )
}
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 .