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 EncryptedChatEmpty struct {
ID int
}
const EncryptedChatEmptyTypeID = 0xab7ec0a0
func (e EncryptedChatEmpty ) construct () EncryptedChatClass { return &e }
var (
_ bin .Encoder = &EncryptedChatEmpty {}
_ bin .Decoder = &EncryptedChatEmpty {}
_ bin .BareEncoder = &EncryptedChatEmpty {}
_ bin .BareDecoder = &EncryptedChatEmpty {}
_ EncryptedChatClass = &EncryptedChatEmpty {}
)
func (e *EncryptedChatEmpty ) Zero () bool {
if e == nil {
return true
}
if !(e .ID == 0 ) {
return false
}
return true
}
func (e *EncryptedChatEmpty ) String () string {
if e == nil {
return "EncryptedChatEmpty(nil)"
}
type Alias EncryptedChatEmpty
return fmt .Sprintf ("EncryptedChatEmpty%+v" , Alias (*e ))
}
func (e *EncryptedChatEmpty ) FillFrom (from interface {
GetID () (value int )
}) {
e .ID = from .GetID ()
}
func (*EncryptedChatEmpty ) TypeID () uint32 {
return EncryptedChatEmptyTypeID
}
func (*EncryptedChatEmpty ) TypeName () string {
return "encryptedChatEmpty"
}
func (e *EncryptedChatEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "encryptedChatEmpty" ,
ID : EncryptedChatEmptyTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (e *EncryptedChatEmpty ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatEmpty#ab7ec0a0 as nil" )
}
b .PutID (EncryptedChatEmptyTypeID )
return e .EncodeBare (b )
}
func (e *EncryptedChatEmpty ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatEmpty#ab7ec0a0 as nil" )
}
b .PutInt (e .ID )
return nil
}
func (e *EncryptedChatEmpty ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatEmpty#ab7ec0a0 to nil" )
}
if err := b .ConsumeID (EncryptedChatEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode encryptedChatEmpty#ab7ec0a0: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EncryptedChatEmpty ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatEmpty#ab7ec0a0 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatEmpty#ab7ec0a0: field id: %w" , err )
}
e .ID = value
}
return nil
}
func (e *EncryptedChatEmpty ) GetID () (value int ) {
if e == nil {
return
}
return e .ID
}
type EncryptedChatWaiting struct {
ID int
AccessHash int64
Date int
AdminID int64
ParticipantID int64
}
const EncryptedChatWaitingTypeID = 0x66b25953
func (e EncryptedChatWaiting ) construct () EncryptedChatClass { return &e }
var (
_ bin .Encoder = &EncryptedChatWaiting {}
_ bin .Decoder = &EncryptedChatWaiting {}
_ bin .BareEncoder = &EncryptedChatWaiting {}
_ bin .BareDecoder = &EncryptedChatWaiting {}
_ EncryptedChatClass = &EncryptedChatWaiting {}
)
func (e *EncryptedChatWaiting ) Zero () bool {
if e == nil {
return true
}
if !(e .ID == 0 ) {
return false
}
if !(e .AccessHash == 0 ) {
return false
}
if !(e .Date == 0 ) {
return false
}
if !(e .AdminID == 0 ) {
return false
}
if !(e .ParticipantID == 0 ) {
return false
}
return true
}
func (e *EncryptedChatWaiting ) String () string {
if e == nil {
return "EncryptedChatWaiting(nil)"
}
type Alias EncryptedChatWaiting
return fmt .Sprintf ("EncryptedChatWaiting%+v" , Alias (*e ))
}
func (e *EncryptedChatWaiting ) FillFrom (from interface {
GetID () (value int )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
}) {
e .ID = from .GetID ()
e .AccessHash = from .GetAccessHash ()
e .Date = from .GetDate ()
e .AdminID = from .GetAdminID ()
e .ParticipantID = from .GetParticipantID ()
}
func (*EncryptedChatWaiting ) TypeID () uint32 {
return EncryptedChatWaitingTypeID
}
func (*EncryptedChatWaiting ) TypeName () string {
return "encryptedChatWaiting"
}
func (e *EncryptedChatWaiting ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "encryptedChatWaiting" ,
ID : EncryptedChatWaitingTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "ParticipantID" ,
SchemaName : "participant_id" ,
},
}
return typ
}
func (e *EncryptedChatWaiting ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatWaiting#66b25953 as nil" )
}
b .PutID (EncryptedChatWaitingTypeID )
return e .EncodeBare (b )
}
func (e *EncryptedChatWaiting ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatWaiting#66b25953 as nil" )
}
b .PutInt (e .ID )
b .PutLong (e .AccessHash )
b .PutInt (e .Date )
b .PutLong (e .AdminID )
b .PutLong (e .ParticipantID )
return nil
}
func (e *EncryptedChatWaiting ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatWaiting#66b25953 to nil" )
}
if err := b .ConsumeID (EncryptedChatWaitingTypeID ); err != nil {
return fmt .Errorf ("unable to decode encryptedChatWaiting#66b25953: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EncryptedChatWaiting ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatWaiting#66b25953 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatWaiting#66b25953: field id: %w" , err )
}
e .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatWaiting#66b25953: field access_hash: %w" , err )
}
e .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatWaiting#66b25953: field date: %w" , err )
}
e .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatWaiting#66b25953: field admin_id: %w" , err )
}
e .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatWaiting#66b25953: field participant_id: %w" , err )
}
e .ParticipantID = value
}
return nil
}
func (e *EncryptedChatWaiting ) GetID () (value int ) {
if e == nil {
return
}
return e .ID
}
func (e *EncryptedChatWaiting ) GetAccessHash () (value int64 ) {
if e == nil {
return
}
return e .AccessHash
}
func (e *EncryptedChatWaiting ) GetDate () (value int ) {
if e == nil {
return
}
return e .Date
}
func (e *EncryptedChatWaiting ) GetAdminID () (value int64 ) {
if e == nil {
return
}
return e .AdminID
}
func (e *EncryptedChatWaiting ) GetParticipantID () (value int64 ) {
if e == nil {
return
}
return e .ParticipantID
}
type EncryptedChatRequested struct {
Flags bin .Fields
FolderID int
ID int
AccessHash int64
Date int
AdminID int64
ParticipantID int64
GA []byte
}
const EncryptedChatRequestedTypeID = 0x48f1d94c
func (e EncryptedChatRequested ) construct () EncryptedChatClass { return &e }
var (
_ bin .Encoder = &EncryptedChatRequested {}
_ bin .Decoder = &EncryptedChatRequested {}
_ bin .BareEncoder = &EncryptedChatRequested {}
_ bin .BareDecoder = &EncryptedChatRequested {}
_ EncryptedChatClass = &EncryptedChatRequested {}
)
func (e *EncryptedChatRequested ) Zero () bool {
if e == nil {
return true
}
if !(e .Flags .Zero ()) {
return false
}
if !(e .FolderID == 0 ) {
return false
}
if !(e .ID == 0 ) {
return false
}
if !(e .AccessHash == 0 ) {
return false
}
if !(e .Date == 0 ) {
return false
}
if !(e .AdminID == 0 ) {
return false
}
if !(e .ParticipantID == 0 ) {
return false
}
if !(e .GA == nil ) {
return false
}
return true
}
func (e *EncryptedChatRequested ) String () string {
if e == nil {
return "EncryptedChatRequested(nil)"
}
type Alias EncryptedChatRequested
return fmt .Sprintf ("EncryptedChatRequested%+v" , Alias (*e ))
}
func (e *EncryptedChatRequested ) FillFrom (from interface {
GetFolderID () (value int , ok bool )
GetID () (value int )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
GetGA () (value []byte )
}) {
if val , ok := from .GetFolderID (); ok {
e .FolderID = val
}
e .ID = from .GetID ()
e .AccessHash = from .GetAccessHash ()
e .Date = from .GetDate ()
e .AdminID = from .GetAdminID ()
e .ParticipantID = from .GetParticipantID ()
e .GA = from .GetGA ()
}
func (*EncryptedChatRequested ) TypeID () uint32 {
return EncryptedChatRequestedTypeID
}
func (*EncryptedChatRequested ) TypeName () string {
return "encryptedChatRequested"
}
func (e *EncryptedChatRequested ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "encryptedChatRequested" ,
ID : EncryptedChatRequestedTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "FolderID" ,
SchemaName : "folder_id" ,
Null : !e .Flags .Has (0 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "ParticipantID" ,
SchemaName : "participant_id" ,
},
{
Name : "GA" ,
SchemaName : "g_a" ,
},
}
return typ
}
func (e *EncryptedChatRequested ) SetFlags () {
if !(e .FolderID == 0 ) {
e .Flags .Set (0 )
}
}
func (e *EncryptedChatRequested ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatRequested#48f1d94c as nil" )
}
b .PutID (EncryptedChatRequestedTypeID )
return e .EncodeBare (b )
}
func (e *EncryptedChatRequested ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatRequested#48f1d94c as nil" )
}
e .SetFlags ()
if err := e .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode encryptedChatRequested#48f1d94c: field flags: %w" , err )
}
if e .Flags .Has (0 ) {
b .PutInt (e .FolderID )
}
b .PutInt (e .ID )
b .PutLong (e .AccessHash )
b .PutInt (e .Date )
b .PutLong (e .AdminID )
b .PutLong (e .ParticipantID )
b .PutBytes (e .GA )
return nil
}
func (e *EncryptedChatRequested ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatRequested#48f1d94c to nil" )
}
if err := b .ConsumeID (EncryptedChatRequestedTypeID ); err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EncryptedChatRequested ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatRequested#48f1d94c to nil" )
}
{
if err := e .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field flags: %w" , err )
}
}
if e .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field folder_id: %w" , err )
}
e .FolderID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field id: %w" , err )
}
e .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field access_hash: %w" , err )
}
e .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field date: %w" , err )
}
e .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field admin_id: %w" , err )
}
e .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field participant_id: %w" , err )
}
e .ParticipantID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatRequested#48f1d94c: field g_a: %w" , err )
}
e .GA = value
}
return nil
}
func (e *EncryptedChatRequested ) SetFolderID (value int ) {
e .Flags .Set (0 )
e .FolderID = value
}
func (e *EncryptedChatRequested ) GetFolderID () (value int , ok bool ) {
if e == nil {
return
}
if !e .Flags .Has (0 ) {
return value , false
}
return e .FolderID , true
}
func (e *EncryptedChatRequested ) GetID () (value int ) {
if e == nil {
return
}
return e .ID
}
func (e *EncryptedChatRequested ) GetAccessHash () (value int64 ) {
if e == nil {
return
}
return e .AccessHash
}
func (e *EncryptedChatRequested ) GetDate () (value int ) {
if e == nil {
return
}
return e .Date
}
func (e *EncryptedChatRequested ) GetAdminID () (value int64 ) {
if e == nil {
return
}
return e .AdminID
}
func (e *EncryptedChatRequested ) GetParticipantID () (value int64 ) {
if e == nil {
return
}
return e .ParticipantID
}
func (e *EncryptedChatRequested ) GetGA () (value []byte ) {
if e == nil {
return
}
return e .GA
}
type EncryptedChat struct {
ID int
AccessHash int64
Date int
AdminID int64
ParticipantID int64
GAOrB []byte
KeyFingerprint int64
}
const EncryptedChatTypeID = 0x61f0d4c7
func (e EncryptedChat ) construct () EncryptedChatClass { return &e }
var (
_ bin .Encoder = &EncryptedChat {}
_ bin .Decoder = &EncryptedChat {}
_ bin .BareEncoder = &EncryptedChat {}
_ bin .BareDecoder = &EncryptedChat {}
_ EncryptedChatClass = &EncryptedChat {}
)
func (e *EncryptedChat ) Zero () bool {
if e == nil {
return true
}
if !(e .ID == 0 ) {
return false
}
if !(e .AccessHash == 0 ) {
return false
}
if !(e .Date == 0 ) {
return false
}
if !(e .AdminID == 0 ) {
return false
}
if !(e .ParticipantID == 0 ) {
return false
}
if !(e .GAOrB == nil ) {
return false
}
if !(e .KeyFingerprint == 0 ) {
return false
}
return true
}
func (e *EncryptedChat ) String () string {
if e == nil {
return "EncryptedChat(nil)"
}
type Alias EncryptedChat
return fmt .Sprintf ("EncryptedChat%+v" , Alias (*e ))
}
func (e *EncryptedChat ) FillFrom (from interface {
GetID () (value int )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
GetGAOrB () (value []byte )
GetKeyFingerprint () (value int64 )
}) {
e .ID = from .GetID ()
e .AccessHash = from .GetAccessHash ()
e .Date = from .GetDate ()
e .AdminID = from .GetAdminID ()
e .ParticipantID = from .GetParticipantID ()
e .GAOrB = from .GetGAOrB ()
e .KeyFingerprint = from .GetKeyFingerprint ()
}
func (*EncryptedChat ) TypeID () uint32 {
return EncryptedChatTypeID
}
func (*EncryptedChat ) TypeName () string {
return "encryptedChat"
}
func (e *EncryptedChat ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "encryptedChat" ,
ID : EncryptedChatTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "ParticipantID" ,
SchemaName : "participant_id" ,
},
{
Name : "GAOrB" ,
SchemaName : "g_a_or_b" ,
},
{
Name : "KeyFingerprint" ,
SchemaName : "key_fingerprint" ,
},
}
return typ
}
func (e *EncryptedChat ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChat#61f0d4c7 as nil" )
}
b .PutID (EncryptedChatTypeID )
return e .EncodeBare (b )
}
func (e *EncryptedChat ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChat#61f0d4c7 as nil" )
}
b .PutInt (e .ID )
b .PutLong (e .AccessHash )
b .PutInt (e .Date )
b .PutLong (e .AdminID )
b .PutLong (e .ParticipantID )
b .PutBytes (e .GAOrB )
b .PutLong (e .KeyFingerprint )
return nil
}
func (e *EncryptedChat ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChat#61f0d4c7 to nil" )
}
if err := b .ConsumeID (EncryptedChatTypeID ); err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EncryptedChat ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChat#61f0d4c7 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field id: %w" , err )
}
e .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field access_hash: %w" , err )
}
e .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field date: %w" , err )
}
e .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field admin_id: %w" , err )
}
e .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field participant_id: %w" , err )
}
e .ParticipantID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field g_a_or_b: %w" , err )
}
e .GAOrB = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChat#61f0d4c7: field key_fingerprint: %w" , err )
}
e .KeyFingerprint = value
}
return nil
}
func (e *EncryptedChat ) GetID () (value int ) {
if e == nil {
return
}
return e .ID
}
func (e *EncryptedChat ) GetAccessHash () (value int64 ) {
if e == nil {
return
}
return e .AccessHash
}
func (e *EncryptedChat ) GetDate () (value int ) {
if e == nil {
return
}
return e .Date
}
func (e *EncryptedChat ) GetAdminID () (value int64 ) {
if e == nil {
return
}
return e .AdminID
}
func (e *EncryptedChat ) GetParticipantID () (value int64 ) {
if e == nil {
return
}
return e .ParticipantID
}
func (e *EncryptedChat ) GetGAOrB () (value []byte ) {
if e == nil {
return
}
return e .GAOrB
}
func (e *EncryptedChat ) GetKeyFingerprint () (value int64 ) {
if e == nil {
return
}
return e .KeyFingerprint
}
type EncryptedChatDiscarded struct {
Flags bin .Fields
HistoryDeleted bool
ID int
}
const EncryptedChatDiscardedTypeID = 0x1e1c7c45
func (e EncryptedChatDiscarded ) construct () EncryptedChatClass { return &e }
var (
_ bin .Encoder = &EncryptedChatDiscarded {}
_ bin .Decoder = &EncryptedChatDiscarded {}
_ bin .BareEncoder = &EncryptedChatDiscarded {}
_ bin .BareDecoder = &EncryptedChatDiscarded {}
_ EncryptedChatClass = &EncryptedChatDiscarded {}
)
func (e *EncryptedChatDiscarded ) Zero () bool {
if e == nil {
return true
}
if !(e .Flags .Zero ()) {
return false
}
if !(e .HistoryDeleted == false ) {
return false
}
if !(e .ID == 0 ) {
return false
}
return true
}
func (e *EncryptedChatDiscarded ) String () string {
if e == nil {
return "EncryptedChatDiscarded(nil)"
}
type Alias EncryptedChatDiscarded
return fmt .Sprintf ("EncryptedChatDiscarded%+v" , Alias (*e ))
}
func (e *EncryptedChatDiscarded ) FillFrom (from interface {
GetHistoryDeleted () (value bool )
GetID () (value int )
}) {
e .HistoryDeleted = from .GetHistoryDeleted ()
e .ID = from .GetID ()
}
func (*EncryptedChatDiscarded ) TypeID () uint32 {
return EncryptedChatDiscardedTypeID
}
func (*EncryptedChatDiscarded ) TypeName () string {
return "encryptedChatDiscarded"
}
func (e *EncryptedChatDiscarded ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "encryptedChatDiscarded" ,
ID : EncryptedChatDiscardedTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "HistoryDeleted" ,
SchemaName : "history_deleted" ,
Null : !e .Flags .Has (0 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (e *EncryptedChatDiscarded ) SetFlags () {
if !(e .HistoryDeleted == false ) {
e .Flags .Set (0 )
}
}
func (e *EncryptedChatDiscarded ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatDiscarded#1e1c7c45 as nil" )
}
b .PutID (EncryptedChatDiscardedTypeID )
return e .EncodeBare (b )
}
func (e *EncryptedChatDiscarded ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode encryptedChatDiscarded#1e1c7c45 as nil" )
}
e .SetFlags ()
if err := e .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode encryptedChatDiscarded#1e1c7c45: field flags: %w" , err )
}
b .PutInt (e .ID )
return nil
}
func (e *EncryptedChatDiscarded ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatDiscarded#1e1c7c45 to nil" )
}
if err := b .ConsumeID (EncryptedChatDiscardedTypeID ); err != nil {
return fmt .Errorf ("unable to decode encryptedChatDiscarded#1e1c7c45: %w" , err )
}
return e .DecodeBare (b )
}
func (e *EncryptedChatDiscarded ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode encryptedChatDiscarded#1e1c7c45 to nil" )
}
{
if err := e .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode encryptedChatDiscarded#1e1c7c45: field flags: %w" , err )
}
}
e .HistoryDeleted = e .Flags .Has (0 )
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode encryptedChatDiscarded#1e1c7c45: field id: %w" , err )
}
e .ID = value
}
return nil
}
func (e *EncryptedChatDiscarded ) SetHistoryDeleted (value bool ) {
if value {
e .Flags .Set (0 )
e .HistoryDeleted = true
} else {
e .Flags .Unset (0 )
e .HistoryDeleted = false
}
}
func (e *EncryptedChatDiscarded ) GetHistoryDeleted () (value bool ) {
if e == nil {
return
}
return e .Flags .Has (0 )
}
func (e *EncryptedChatDiscarded ) GetID () (value int ) {
if e == nil {
return
}
return e .ID
}
const EncryptedChatClassName = "EncryptedChat"
type EncryptedChatClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () EncryptedChatClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value int )
AsNotEmpty () (NotEmptyEncryptedChat , bool )
}
func (e *EncryptedChat ) AsInput () *InputEncryptedChat {
value := new (InputEncryptedChat )
value .ChatID = e .GetID ()
value .AccessHash = e .GetAccessHash ()
return value
}
type NotEmptyEncryptedChat interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () EncryptedChatClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value int )
}
func (e *EncryptedChatEmpty ) AsNotEmpty () (NotEmptyEncryptedChat , bool ) {
value , ok := (EncryptedChatClass (e )).(NotEmptyEncryptedChat )
return value , ok
}
func (e *EncryptedChatWaiting ) AsNotEmpty () (NotEmptyEncryptedChat , bool ) {
value , ok := (EncryptedChatClass (e )).(NotEmptyEncryptedChat )
return value , ok
}
func (e *EncryptedChatRequested ) AsNotEmpty () (NotEmptyEncryptedChat , bool ) {
value , ok := (EncryptedChatClass (e )).(NotEmptyEncryptedChat )
return value , ok
}
func (e *EncryptedChat ) AsNotEmpty () (NotEmptyEncryptedChat , bool ) {
value , ok := (EncryptedChatClass (e )).(NotEmptyEncryptedChat )
return value , ok
}
func (e *EncryptedChatDiscarded ) AsNotEmpty () (NotEmptyEncryptedChat , bool ) {
value , ok := (EncryptedChatClass (e )).(NotEmptyEncryptedChat )
return value , ok
}
func DecodeEncryptedChat (buf *bin .Buffer ) (EncryptedChatClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case EncryptedChatEmptyTypeID :
v := EncryptedChatEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EncryptedChatClass: %w" , err )
}
return &v , nil
case EncryptedChatWaitingTypeID :
v := EncryptedChatWaiting {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EncryptedChatClass: %w" , err )
}
return &v , nil
case EncryptedChatRequestedTypeID :
v := EncryptedChatRequested {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EncryptedChatClass: %w" , err )
}
return &v , nil
case EncryptedChatTypeID :
v := EncryptedChat {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EncryptedChatClass: %w" , err )
}
return &v , nil
case EncryptedChatDiscardedTypeID :
v := EncryptedChatDiscarded {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode EncryptedChatClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode EncryptedChatClass: %w" , bin .NewUnexpectedID (id ))
}
}
type EncryptedChatBox struct {
EncryptedChat EncryptedChatClass
}
func (b *EncryptedChatBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode EncryptedChatBox to nil" )
}
v , err := DecodeEncryptedChat (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .EncryptedChat = v
return nil
}
func (b *EncryptedChatBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .EncryptedChat == nil {
return fmt .Errorf ("unable to encode EncryptedChatClass as nil" )
}
return b .EncryptedChat .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 .