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 PhoneCallEmpty struct {
ID int64
}
const PhoneCallEmptyTypeID = 0x5366c915
func (p PhoneCallEmpty ) construct () PhoneCallClass { return &p }
var (
_ bin .Encoder = &PhoneCallEmpty {}
_ bin .Decoder = &PhoneCallEmpty {}
_ bin .BareEncoder = &PhoneCallEmpty {}
_ bin .BareDecoder = &PhoneCallEmpty {}
_ PhoneCallClass = &PhoneCallEmpty {}
)
func (p *PhoneCallEmpty ) Zero () bool {
if p == nil {
return true
}
if !(p .ID == 0 ) {
return false
}
return true
}
func (p *PhoneCallEmpty ) String () string {
if p == nil {
return "PhoneCallEmpty(nil)"
}
type Alias PhoneCallEmpty
return fmt .Sprintf ("PhoneCallEmpty%+v" , Alias (*p ))
}
func (p *PhoneCallEmpty ) FillFrom (from interface {
GetID () (value int64 )
}) {
p .ID = from .GetID ()
}
func (*PhoneCallEmpty ) TypeID () uint32 {
return PhoneCallEmptyTypeID
}
func (*PhoneCallEmpty ) TypeName () string {
return "phoneCallEmpty"
}
func (p *PhoneCallEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallEmpty" ,
ID : PhoneCallEmptyTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (p *PhoneCallEmpty ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallEmpty#5366c915 as nil" )
}
b .PutID (PhoneCallEmptyTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallEmpty ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallEmpty#5366c915 as nil" )
}
b .PutLong (p .ID )
return nil
}
func (p *PhoneCallEmpty ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallEmpty#5366c915 to nil" )
}
if err := b .ConsumeID (PhoneCallEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallEmpty#5366c915: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallEmpty ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallEmpty#5366c915 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallEmpty#5366c915: field id: %w" , err )
}
p .ID = value
}
return nil
}
func (p *PhoneCallEmpty ) GetID () (value int64 ) {
if p == nil {
return
}
return p .ID
}
type PhoneCallWaiting struct {
Flags bin .Fields
Video bool
ID int64
AccessHash int64
Date int
AdminID int64
ParticipantID int64
Protocol PhoneCallProtocol
ReceiveDate int
}
const PhoneCallWaitingTypeID = 0xc5226f17
func (p PhoneCallWaiting ) construct () PhoneCallClass { return &p }
var (
_ bin .Encoder = &PhoneCallWaiting {}
_ bin .Decoder = &PhoneCallWaiting {}
_ bin .BareEncoder = &PhoneCallWaiting {}
_ bin .BareDecoder = &PhoneCallWaiting {}
_ PhoneCallClass = &PhoneCallWaiting {}
)
func (p *PhoneCallWaiting ) Zero () bool {
if p == nil {
return true
}
if !(p .Flags .Zero ()) {
return false
}
if !(p .Video == false ) {
return false
}
if !(p .ID == 0 ) {
return false
}
if !(p .AccessHash == 0 ) {
return false
}
if !(p .Date == 0 ) {
return false
}
if !(p .AdminID == 0 ) {
return false
}
if !(p .ParticipantID == 0 ) {
return false
}
if !(p .Protocol .Zero ()) {
return false
}
if !(p .ReceiveDate == 0 ) {
return false
}
return true
}
func (p *PhoneCallWaiting ) String () string {
if p == nil {
return "PhoneCallWaiting(nil)"
}
type Alias PhoneCallWaiting
return fmt .Sprintf ("PhoneCallWaiting%+v" , Alias (*p ))
}
func (p *PhoneCallWaiting ) FillFrom (from interface {
GetVideo () (value bool )
GetID () (value int64 )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
GetProtocol () (value PhoneCallProtocol )
GetReceiveDate () (value int , ok bool )
}) {
p .Video = from .GetVideo ()
p .ID = from .GetID ()
p .AccessHash = from .GetAccessHash ()
p .Date = from .GetDate ()
p .AdminID = from .GetAdminID ()
p .ParticipantID = from .GetParticipantID ()
p .Protocol = from .GetProtocol ()
if val , ok := from .GetReceiveDate (); ok {
p .ReceiveDate = val
}
}
func (*PhoneCallWaiting ) TypeID () uint32 {
return PhoneCallWaitingTypeID
}
func (*PhoneCallWaiting ) TypeName () string {
return "phoneCallWaiting"
}
func (p *PhoneCallWaiting ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallWaiting" ,
ID : PhoneCallWaitingTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Video" ,
SchemaName : "video" ,
Null : !p .Flags .Has (6 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "ParticipantID" ,
SchemaName : "participant_id" ,
},
{
Name : "Protocol" ,
SchemaName : "protocol" ,
},
{
Name : "ReceiveDate" ,
SchemaName : "receive_date" ,
Null : !p .Flags .Has (0 ),
},
}
return typ
}
func (p *PhoneCallWaiting ) SetFlags () {
if !(p .Video == false ) {
p .Flags .Set (6 )
}
if !(p .ReceiveDate == 0 ) {
p .Flags .Set (0 )
}
}
func (p *PhoneCallWaiting ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallWaiting#c5226f17 as nil" )
}
b .PutID (PhoneCallWaitingTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallWaiting ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallWaiting#c5226f17 as nil" )
}
p .SetFlags ()
if err := p .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallWaiting#c5226f17: field flags: %w" , err )
}
b .PutLong (p .ID )
b .PutLong (p .AccessHash )
b .PutInt (p .Date )
b .PutLong (p .AdminID )
b .PutLong (p .ParticipantID )
if err := p .Protocol .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallWaiting#c5226f17: field protocol: %w" , err )
}
if p .Flags .Has (0 ) {
b .PutInt (p .ReceiveDate )
}
return nil
}
func (p *PhoneCallWaiting ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallWaiting#c5226f17 to nil" )
}
if err := b .ConsumeID (PhoneCallWaitingTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallWaiting ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallWaiting#c5226f17 to nil" )
}
{
if err := p .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field flags: %w" , err )
}
}
p .Video = p .Flags .Has (6 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field id: %w" , err )
}
p .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field access_hash: %w" , err )
}
p .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field date: %w" , err )
}
p .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field admin_id: %w" , err )
}
p .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field participant_id: %w" , err )
}
p .ParticipantID = value
}
{
if err := p .Protocol .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field protocol: %w" , err )
}
}
if p .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallWaiting#c5226f17: field receive_date: %w" , err )
}
p .ReceiveDate = value
}
return nil
}
func (p *PhoneCallWaiting ) SetVideo (value bool ) {
if value {
p .Flags .Set (6 )
p .Video = true
} else {
p .Flags .Unset (6 )
p .Video = false
}
}
func (p *PhoneCallWaiting ) GetVideo () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (6 )
}
func (p *PhoneCallWaiting ) GetID () (value int64 ) {
if p == nil {
return
}
return p .ID
}
func (p *PhoneCallWaiting ) GetAccessHash () (value int64 ) {
if p == nil {
return
}
return p .AccessHash
}
func (p *PhoneCallWaiting ) GetDate () (value int ) {
if p == nil {
return
}
return p .Date
}
func (p *PhoneCallWaiting ) GetAdminID () (value int64 ) {
if p == nil {
return
}
return p .AdminID
}
func (p *PhoneCallWaiting ) GetParticipantID () (value int64 ) {
if p == nil {
return
}
return p .ParticipantID
}
func (p *PhoneCallWaiting ) GetProtocol () (value PhoneCallProtocol ) {
if p == nil {
return
}
return p .Protocol
}
func (p *PhoneCallWaiting ) SetReceiveDate (value int ) {
p .Flags .Set (0 )
p .ReceiveDate = value
}
func (p *PhoneCallWaiting ) GetReceiveDate () (value int , ok bool ) {
if p == nil {
return
}
if !p .Flags .Has (0 ) {
return value , false
}
return p .ReceiveDate , true
}
type PhoneCallRequested struct {
Flags bin .Fields
Video bool
ID int64
AccessHash int64
Date int
AdminID int64
ParticipantID int64
GAHash []byte
Protocol PhoneCallProtocol
}
const PhoneCallRequestedTypeID = 0x14b0ed0c
func (p PhoneCallRequested ) construct () PhoneCallClass { return &p }
var (
_ bin .Encoder = &PhoneCallRequested {}
_ bin .Decoder = &PhoneCallRequested {}
_ bin .BareEncoder = &PhoneCallRequested {}
_ bin .BareDecoder = &PhoneCallRequested {}
_ PhoneCallClass = &PhoneCallRequested {}
)
func (p *PhoneCallRequested ) Zero () bool {
if p == nil {
return true
}
if !(p .Flags .Zero ()) {
return false
}
if !(p .Video == false ) {
return false
}
if !(p .ID == 0 ) {
return false
}
if !(p .AccessHash == 0 ) {
return false
}
if !(p .Date == 0 ) {
return false
}
if !(p .AdminID == 0 ) {
return false
}
if !(p .ParticipantID == 0 ) {
return false
}
if !(p .GAHash == nil ) {
return false
}
if !(p .Protocol .Zero ()) {
return false
}
return true
}
func (p *PhoneCallRequested ) String () string {
if p == nil {
return "PhoneCallRequested(nil)"
}
type Alias PhoneCallRequested
return fmt .Sprintf ("PhoneCallRequested%+v" , Alias (*p ))
}
func (p *PhoneCallRequested ) FillFrom (from interface {
GetVideo () (value bool )
GetID () (value int64 )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
GetGAHash () (value []byte )
GetProtocol () (value PhoneCallProtocol )
}) {
p .Video = from .GetVideo ()
p .ID = from .GetID ()
p .AccessHash = from .GetAccessHash ()
p .Date = from .GetDate ()
p .AdminID = from .GetAdminID ()
p .ParticipantID = from .GetParticipantID ()
p .GAHash = from .GetGAHash ()
p .Protocol = from .GetProtocol ()
}
func (*PhoneCallRequested ) TypeID () uint32 {
return PhoneCallRequestedTypeID
}
func (*PhoneCallRequested ) TypeName () string {
return "phoneCallRequested"
}
func (p *PhoneCallRequested ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallRequested" ,
ID : PhoneCallRequestedTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Video" ,
SchemaName : "video" ,
Null : !p .Flags .Has (6 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "ParticipantID" ,
SchemaName : "participant_id" ,
},
{
Name : "GAHash" ,
SchemaName : "g_a_hash" ,
},
{
Name : "Protocol" ,
SchemaName : "protocol" ,
},
}
return typ
}
func (p *PhoneCallRequested ) SetFlags () {
if !(p .Video == false ) {
p .Flags .Set (6 )
}
}
func (p *PhoneCallRequested ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallRequested#14b0ed0c as nil" )
}
b .PutID (PhoneCallRequestedTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallRequested ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallRequested#14b0ed0c as nil" )
}
p .SetFlags ()
if err := p .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallRequested#14b0ed0c: field flags: %w" , err )
}
b .PutLong (p .ID )
b .PutLong (p .AccessHash )
b .PutInt (p .Date )
b .PutLong (p .AdminID )
b .PutLong (p .ParticipantID )
b .PutBytes (p .GAHash )
if err := p .Protocol .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallRequested#14b0ed0c: field protocol: %w" , err )
}
return nil
}
func (p *PhoneCallRequested ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallRequested#14b0ed0c to nil" )
}
if err := b .ConsumeID (PhoneCallRequestedTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallRequested ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallRequested#14b0ed0c to nil" )
}
{
if err := p .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field flags: %w" , err )
}
}
p .Video = p .Flags .Has (6 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field id: %w" , err )
}
p .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field access_hash: %w" , err )
}
p .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field date: %w" , err )
}
p .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field admin_id: %w" , err )
}
p .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field participant_id: %w" , err )
}
p .ParticipantID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field g_a_hash: %w" , err )
}
p .GAHash = value
}
{
if err := p .Protocol .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallRequested#14b0ed0c: field protocol: %w" , err )
}
}
return nil
}
func (p *PhoneCallRequested ) SetVideo (value bool ) {
if value {
p .Flags .Set (6 )
p .Video = true
} else {
p .Flags .Unset (6 )
p .Video = false
}
}
func (p *PhoneCallRequested ) GetVideo () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (6 )
}
func (p *PhoneCallRequested ) GetID () (value int64 ) {
if p == nil {
return
}
return p .ID
}
func (p *PhoneCallRequested ) GetAccessHash () (value int64 ) {
if p == nil {
return
}
return p .AccessHash
}
func (p *PhoneCallRequested ) GetDate () (value int ) {
if p == nil {
return
}
return p .Date
}
func (p *PhoneCallRequested ) GetAdminID () (value int64 ) {
if p == nil {
return
}
return p .AdminID
}
func (p *PhoneCallRequested ) GetParticipantID () (value int64 ) {
if p == nil {
return
}
return p .ParticipantID
}
func (p *PhoneCallRequested ) GetGAHash () (value []byte ) {
if p == nil {
return
}
return p .GAHash
}
func (p *PhoneCallRequested ) GetProtocol () (value PhoneCallProtocol ) {
if p == nil {
return
}
return p .Protocol
}
type PhoneCallAccepted struct {
Flags bin .Fields
Video bool
ID int64
AccessHash int64
Date int
AdminID int64
ParticipantID int64
GB []byte
Protocol PhoneCallProtocol
}
const PhoneCallAcceptedTypeID = 0x3660c311
func (p PhoneCallAccepted ) construct () PhoneCallClass { return &p }
var (
_ bin .Encoder = &PhoneCallAccepted {}
_ bin .Decoder = &PhoneCallAccepted {}
_ bin .BareEncoder = &PhoneCallAccepted {}
_ bin .BareDecoder = &PhoneCallAccepted {}
_ PhoneCallClass = &PhoneCallAccepted {}
)
func (p *PhoneCallAccepted ) Zero () bool {
if p == nil {
return true
}
if !(p .Flags .Zero ()) {
return false
}
if !(p .Video == false ) {
return false
}
if !(p .ID == 0 ) {
return false
}
if !(p .AccessHash == 0 ) {
return false
}
if !(p .Date == 0 ) {
return false
}
if !(p .AdminID == 0 ) {
return false
}
if !(p .ParticipantID == 0 ) {
return false
}
if !(p .GB == nil ) {
return false
}
if !(p .Protocol .Zero ()) {
return false
}
return true
}
func (p *PhoneCallAccepted ) String () string {
if p == nil {
return "PhoneCallAccepted(nil)"
}
type Alias PhoneCallAccepted
return fmt .Sprintf ("PhoneCallAccepted%+v" , Alias (*p ))
}
func (p *PhoneCallAccepted ) FillFrom (from interface {
GetVideo () (value bool )
GetID () (value int64 )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
GetGB () (value []byte )
GetProtocol () (value PhoneCallProtocol )
}) {
p .Video = from .GetVideo ()
p .ID = from .GetID ()
p .AccessHash = from .GetAccessHash ()
p .Date = from .GetDate ()
p .AdminID = from .GetAdminID ()
p .ParticipantID = from .GetParticipantID ()
p .GB = from .GetGB ()
p .Protocol = from .GetProtocol ()
}
func (*PhoneCallAccepted ) TypeID () uint32 {
return PhoneCallAcceptedTypeID
}
func (*PhoneCallAccepted ) TypeName () string {
return "phoneCallAccepted"
}
func (p *PhoneCallAccepted ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallAccepted" ,
ID : PhoneCallAcceptedTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Video" ,
SchemaName : "video" ,
Null : !p .Flags .Has (6 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "AccessHash" ,
SchemaName : "access_hash" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "AdminID" ,
SchemaName : "admin_id" ,
},
{
Name : "ParticipantID" ,
SchemaName : "participant_id" ,
},
{
Name : "GB" ,
SchemaName : "g_b" ,
},
{
Name : "Protocol" ,
SchemaName : "protocol" ,
},
}
return typ
}
func (p *PhoneCallAccepted ) SetFlags () {
if !(p .Video == false ) {
p .Flags .Set (6 )
}
}
func (p *PhoneCallAccepted ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallAccepted#3660c311 as nil" )
}
b .PutID (PhoneCallAcceptedTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallAccepted ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallAccepted#3660c311 as nil" )
}
p .SetFlags ()
if err := p .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallAccepted#3660c311: field flags: %w" , err )
}
b .PutLong (p .ID )
b .PutLong (p .AccessHash )
b .PutInt (p .Date )
b .PutLong (p .AdminID )
b .PutLong (p .ParticipantID )
b .PutBytes (p .GB )
if err := p .Protocol .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallAccepted#3660c311: field protocol: %w" , err )
}
return nil
}
func (p *PhoneCallAccepted ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallAccepted#3660c311 to nil" )
}
if err := b .ConsumeID (PhoneCallAcceptedTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallAccepted ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallAccepted#3660c311 to nil" )
}
{
if err := p .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field flags: %w" , err )
}
}
p .Video = p .Flags .Has (6 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field id: %w" , err )
}
p .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field access_hash: %w" , err )
}
p .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field date: %w" , err )
}
p .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field admin_id: %w" , err )
}
p .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field participant_id: %w" , err )
}
p .ParticipantID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field g_b: %w" , err )
}
p .GB = value
}
{
if err := p .Protocol .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallAccepted#3660c311: field protocol: %w" , err )
}
}
return nil
}
func (p *PhoneCallAccepted ) SetVideo (value bool ) {
if value {
p .Flags .Set (6 )
p .Video = true
} else {
p .Flags .Unset (6 )
p .Video = false
}
}
func (p *PhoneCallAccepted ) GetVideo () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (6 )
}
func (p *PhoneCallAccepted ) GetID () (value int64 ) {
if p == nil {
return
}
return p .ID
}
func (p *PhoneCallAccepted ) GetAccessHash () (value int64 ) {
if p == nil {
return
}
return p .AccessHash
}
func (p *PhoneCallAccepted ) GetDate () (value int ) {
if p == nil {
return
}
return p .Date
}
func (p *PhoneCallAccepted ) GetAdminID () (value int64 ) {
if p == nil {
return
}
return p .AdminID
}
func (p *PhoneCallAccepted ) GetParticipantID () (value int64 ) {
if p == nil {
return
}
return p .ParticipantID
}
func (p *PhoneCallAccepted ) GetGB () (value []byte ) {
if p == nil {
return
}
return p .GB
}
func (p *PhoneCallAccepted ) GetProtocol () (value PhoneCallProtocol ) {
if p == nil {
return
}
return p .Protocol
}
type PhoneCall struct {
Flags bin .Fields
P2PAllowed bool
Video bool
ID int64
AccessHash int64
Date int
AdminID int64
ParticipantID int64
GAOrB []byte
KeyFingerprint int64
Protocol PhoneCallProtocol
Connections []PhoneConnectionClass
StartDate int
}
const PhoneCallTypeID = 0x967f7c67
func (p PhoneCall ) construct () PhoneCallClass { return &p }
var (
_ bin .Encoder = &PhoneCall {}
_ bin .Decoder = &PhoneCall {}
_ bin .BareEncoder = &PhoneCall {}
_ bin .BareDecoder = &PhoneCall {}
_ PhoneCallClass = &PhoneCall {}
)
func (p *PhoneCall ) Zero () bool {
if p == nil {
return true
}
if !(p .Flags .Zero ()) {
return false
}
if !(p .P2PAllowed == false ) {
return false
}
if !(p .Video == false ) {
return false
}
if !(p .ID == 0 ) {
return false
}
if !(p .AccessHash == 0 ) {
return false
}
if !(p .Date == 0 ) {
return false
}
if !(p .AdminID == 0 ) {
return false
}
if !(p .ParticipantID == 0 ) {
return false
}
if !(p .GAOrB == nil ) {
return false
}
if !(p .KeyFingerprint == 0 ) {
return false
}
if !(p .Protocol .Zero ()) {
return false
}
if !(p .Connections == nil ) {
return false
}
if !(p .StartDate == 0 ) {
return false
}
return true
}
func (p *PhoneCall ) String () string {
if p == nil {
return "PhoneCall(nil)"
}
type Alias PhoneCall
return fmt .Sprintf ("PhoneCall%+v" , Alias (*p ))
}
func (p *PhoneCall ) FillFrom (from interface {
GetP2PAllowed () (value bool )
GetVideo () (value bool )
GetID () (value int64 )
GetAccessHash () (value int64 )
GetDate () (value int )
GetAdminID () (value int64 )
GetParticipantID () (value int64 )
GetGAOrB () (value []byte )
GetKeyFingerprint () (value int64 )
GetProtocol () (value PhoneCallProtocol )
GetConnections () (value []PhoneConnectionClass )
GetStartDate () (value int )
}) {
p .P2PAllowed = from .GetP2PAllowed ()
p .Video = from .GetVideo ()
p .ID = from .GetID ()
p .AccessHash = from .GetAccessHash ()
p .Date = from .GetDate ()
p .AdminID = from .GetAdminID ()
p .ParticipantID = from .GetParticipantID ()
p .GAOrB = from .GetGAOrB ()
p .KeyFingerprint = from .GetKeyFingerprint ()
p .Protocol = from .GetProtocol ()
p .Connections = from .GetConnections ()
p .StartDate = from .GetStartDate ()
}
func (*PhoneCall ) TypeID () uint32 {
return PhoneCallTypeID
}
func (*PhoneCall ) TypeName () string {
return "phoneCall"
}
func (p *PhoneCall ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCall" ,
ID : PhoneCallTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "P2PAllowed" ,
SchemaName : "p2p_allowed" ,
Null : !p .Flags .Has (5 ),
},
{
Name : "Video" ,
SchemaName : "video" ,
Null : !p .Flags .Has (6 ),
},
{
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" ,
},
{
Name : "Protocol" ,
SchemaName : "protocol" ,
},
{
Name : "Connections" ,
SchemaName : "connections" ,
},
{
Name : "StartDate" ,
SchemaName : "start_date" ,
},
}
return typ
}
func (p *PhoneCall ) SetFlags () {
if !(p .P2PAllowed == false ) {
p .Flags .Set (5 )
}
if !(p .Video == false ) {
p .Flags .Set (6 )
}
}
func (p *PhoneCall ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCall#967f7c67 as nil" )
}
b .PutID (PhoneCallTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCall ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCall#967f7c67 as nil" )
}
p .SetFlags ()
if err := p .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCall#967f7c67: field flags: %w" , err )
}
b .PutLong (p .ID )
b .PutLong (p .AccessHash )
b .PutInt (p .Date )
b .PutLong (p .AdminID )
b .PutLong (p .ParticipantID )
b .PutBytes (p .GAOrB )
b .PutLong (p .KeyFingerprint )
if err := p .Protocol .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCall#967f7c67: field protocol: %w" , err )
}
b .PutVectorHeader (len (p .Connections ))
for idx , v := range p .Connections {
if v == nil {
return fmt .Errorf ("unable to encode phoneCall#967f7c67: field connections element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCall#967f7c67: field connections element with index %d: %w" , idx , err )
}
}
b .PutInt (p .StartDate )
return nil
}
func (p *PhoneCall ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCall#967f7c67 to nil" )
}
if err := b .ConsumeID (PhoneCallTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCall ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCall#967f7c67 to nil" )
}
{
if err := p .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field flags: %w" , err )
}
}
p .P2PAllowed = p .Flags .Has (5 )
p .Video = p .Flags .Has (6 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field id: %w" , err )
}
p .ID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field access_hash: %w" , err )
}
p .AccessHash = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field date: %w" , err )
}
p .Date = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field admin_id: %w" , err )
}
p .AdminID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field participant_id: %w" , err )
}
p .ParticipantID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field g_a_or_b: %w" , err )
}
p .GAOrB = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field key_fingerprint: %w" , err )
}
p .KeyFingerprint = value
}
{
if err := p .Protocol .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field protocol: %w" , err )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field connections: %w" , err )
}
if headerLen > 0 {
p .Connections = make ([]PhoneConnectionClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodePhoneConnection (b )
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field connections: %w" , err )
}
p .Connections = append (p .Connections , value )
}
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCall#967f7c67: field start_date: %w" , err )
}
p .StartDate = value
}
return nil
}
func (p *PhoneCall ) SetP2PAllowed (value bool ) {
if value {
p .Flags .Set (5 )
p .P2PAllowed = true
} else {
p .Flags .Unset (5 )
p .P2PAllowed = false
}
}
func (p *PhoneCall ) GetP2PAllowed () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (5 )
}
func (p *PhoneCall ) SetVideo (value bool ) {
if value {
p .Flags .Set (6 )
p .Video = true
} else {
p .Flags .Unset (6 )
p .Video = false
}
}
func (p *PhoneCall ) GetVideo () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (6 )
}
func (p *PhoneCall ) GetID () (value int64 ) {
if p == nil {
return
}
return p .ID
}
func (p *PhoneCall ) GetAccessHash () (value int64 ) {
if p == nil {
return
}
return p .AccessHash
}
func (p *PhoneCall ) GetDate () (value int ) {
if p == nil {
return
}
return p .Date
}
func (p *PhoneCall ) GetAdminID () (value int64 ) {
if p == nil {
return
}
return p .AdminID
}
func (p *PhoneCall ) GetParticipantID () (value int64 ) {
if p == nil {
return
}
return p .ParticipantID
}
func (p *PhoneCall ) GetGAOrB () (value []byte ) {
if p == nil {
return
}
return p .GAOrB
}
func (p *PhoneCall ) GetKeyFingerprint () (value int64 ) {
if p == nil {
return
}
return p .KeyFingerprint
}
func (p *PhoneCall ) GetProtocol () (value PhoneCallProtocol ) {
if p == nil {
return
}
return p .Protocol
}
func (p *PhoneCall ) GetConnections () (value []PhoneConnectionClass ) {
if p == nil {
return
}
return p .Connections
}
func (p *PhoneCall ) GetStartDate () (value int ) {
if p == nil {
return
}
return p .StartDate
}
func (p *PhoneCall ) MapConnections () (value PhoneConnectionClassArray ) {
return PhoneConnectionClassArray (p .Connections )
}
type PhoneCallDiscarded struct {
Flags bin .Fields
NeedRating bool
NeedDebug bool
Video bool
ID int64
Reason PhoneCallDiscardReasonClass
Duration int
}
const PhoneCallDiscardedTypeID = 0x50ca4de1
func (p PhoneCallDiscarded ) construct () PhoneCallClass { return &p }
var (
_ bin .Encoder = &PhoneCallDiscarded {}
_ bin .Decoder = &PhoneCallDiscarded {}
_ bin .BareEncoder = &PhoneCallDiscarded {}
_ bin .BareDecoder = &PhoneCallDiscarded {}
_ PhoneCallClass = &PhoneCallDiscarded {}
)
func (p *PhoneCallDiscarded ) Zero () bool {
if p == nil {
return true
}
if !(p .Flags .Zero ()) {
return false
}
if !(p .NeedRating == false ) {
return false
}
if !(p .NeedDebug == false ) {
return false
}
if !(p .Video == false ) {
return false
}
if !(p .ID == 0 ) {
return false
}
if !(p .Reason == nil ) {
return false
}
if !(p .Duration == 0 ) {
return false
}
return true
}
func (p *PhoneCallDiscarded ) String () string {
if p == nil {
return "PhoneCallDiscarded(nil)"
}
type Alias PhoneCallDiscarded
return fmt .Sprintf ("PhoneCallDiscarded%+v" , Alias (*p ))
}
func (p *PhoneCallDiscarded ) FillFrom (from interface {
GetNeedRating () (value bool )
GetNeedDebug () (value bool )
GetVideo () (value bool )
GetID () (value int64 )
GetReason () (value PhoneCallDiscardReasonClass , ok bool )
GetDuration () (value int , ok bool )
}) {
p .NeedRating = from .GetNeedRating ()
p .NeedDebug = from .GetNeedDebug ()
p .Video = from .GetVideo ()
p .ID = from .GetID ()
if val , ok := from .GetReason (); ok {
p .Reason = val
}
if val , ok := from .GetDuration (); ok {
p .Duration = val
}
}
func (*PhoneCallDiscarded ) TypeID () uint32 {
return PhoneCallDiscardedTypeID
}
func (*PhoneCallDiscarded ) TypeName () string {
return "phoneCallDiscarded"
}
func (p *PhoneCallDiscarded ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallDiscarded" ,
ID : PhoneCallDiscardedTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "NeedRating" ,
SchemaName : "need_rating" ,
Null : !p .Flags .Has (2 ),
},
{
Name : "NeedDebug" ,
SchemaName : "need_debug" ,
Null : !p .Flags .Has (3 ),
},
{
Name : "Video" ,
SchemaName : "video" ,
Null : !p .Flags .Has (6 ),
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Reason" ,
SchemaName : "reason" ,
Null : !p .Flags .Has (0 ),
},
{
Name : "Duration" ,
SchemaName : "duration" ,
Null : !p .Flags .Has (1 ),
},
}
return typ
}
func (p *PhoneCallDiscarded ) SetFlags () {
if !(p .NeedRating == false ) {
p .Flags .Set (2 )
}
if !(p .NeedDebug == false ) {
p .Flags .Set (3 )
}
if !(p .Video == false ) {
p .Flags .Set (6 )
}
if !(p .Reason == nil ) {
p .Flags .Set (0 )
}
if !(p .Duration == 0 ) {
p .Flags .Set (1 )
}
}
func (p *PhoneCallDiscarded ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscarded#50ca4de1 as nil" )
}
b .PutID (PhoneCallDiscardedTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallDiscarded ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscarded#50ca4de1 as nil" )
}
p .SetFlags ()
if err := p .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallDiscarded#50ca4de1: field flags: %w" , err )
}
b .PutLong (p .ID )
if p .Flags .Has (0 ) {
if p .Reason == nil {
return fmt .Errorf ("unable to encode phoneCallDiscarded#50ca4de1: field reason is nil" )
}
if err := p .Reason .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode phoneCallDiscarded#50ca4de1: field reason: %w" , err )
}
}
if p .Flags .Has (1 ) {
b .PutInt (p .Duration )
}
return nil
}
func (p *PhoneCallDiscarded ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscarded#50ca4de1 to nil" )
}
if err := b .ConsumeID (PhoneCallDiscardedTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscarded#50ca4de1: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallDiscarded ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscarded#50ca4de1 to nil" )
}
{
if err := p .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscarded#50ca4de1: field flags: %w" , err )
}
}
p .NeedRating = p .Flags .Has (2 )
p .NeedDebug = p .Flags .Has (3 )
p .Video = p .Flags .Has (6 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscarded#50ca4de1: field id: %w" , err )
}
p .ID = value
}
if p .Flags .Has (0 ) {
value , err := DecodePhoneCallDiscardReason (b )
if err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscarded#50ca4de1: field reason: %w" , err )
}
p .Reason = value
}
if p .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscarded#50ca4de1: field duration: %w" , err )
}
p .Duration = value
}
return nil
}
func (p *PhoneCallDiscarded ) SetNeedRating (value bool ) {
if value {
p .Flags .Set (2 )
p .NeedRating = true
} else {
p .Flags .Unset (2 )
p .NeedRating = false
}
}
func (p *PhoneCallDiscarded ) GetNeedRating () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (2 )
}
func (p *PhoneCallDiscarded ) SetNeedDebug (value bool ) {
if value {
p .Flags .Set (3 )
p .NeedDebug = true
} else {
p .Flags .Unset (3 )
p .NeedDebug = false
}
}
func (p *PhoneCallDiscarded ) GetNeedDebug () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (3 )
}
func (p *PhoneCallDiscarded ) SetVideo (value bool ) {
if value {
p .Flags .Set (6 )
p .Video = true
} else {
p .Flags .Unset (6 )
p .Video = false
}
}
func (p *PhoneCallDiscarded ) GetVideo () (value bool ) {
if p == nil {
return
}
return p .Flags .Has (6 )
}
func (p *PhoneCallDiscarded ) GetID () (value int64 ) {
if p == nil {
return
}
return p .ID
}
func (p *PhoneCallDiscarded ) SetReason (value PhoneCallDiscardReasonClass ) {
p .Flags .Set (0 )
p .Reason = value
}
func (p *PhoneCallDiscarded ) GetReason () (value PhoneCallDiscardReasonClass , ok bool ) {
if p == nil {
return
}
if !p .Flags .Has (0 ) {
return value , false
}
return p .Reason , true
}
func (p *PhoneCallDiscarded ) SetDuration (value int ) {
p .Flags .Set (1 )
p .Duration = value
}
func (p *PhoneCallDiscarded ) GetDuration () (value int , ok bool ) {
if p == nil {
return
}
if !p .Flags .Has (1 ) {
return value , false
}
return p .Duration , true
}
const PhoneCallClassName = "PhoneCall"
type PhoneCallClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PhoneCallClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetID () (value int64 )
AsNotEmpty () (NotEmptyPhoneCall , bool )
}
func (p *PhoneCall ) AsInput () *InputPhoneCall {
value := new (InputPhoneCall )
value .ID = p .GetID ()
value .AccessHash = p .GetAccessHash ()
return value
}
type NotEmptyPhoneCall interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PhoneCallClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetVideo () (value bool )
GetID () (value int64 )
}
func (p *PhoneCallEmpty ) AsNotEmpty () (NotEmptyPhoneCall , bool ) {
value , ok := (PhoneCallClass (p )).(NotEmptyPhoneCall )
return value , ok
}
func (p *PhoneCallWaiting ) AsNotEmpty () (NotEmptyPhoneCall , bool ) {
value , ok := (PhoneCallClass (p )).(NotEmptyPhoneCall )
return value , ok
}
func (p *PhoneCallRequested ) AsNotEmpty () (NotEmptyPhoneCall , bool ) {
value , ok := (PhoneCallClass (p )).(NotEmptyPhoneCall )
return value , ok
}
func (p *PhoneCallAccepted ) AsNotEmpty () (NotEmptyPhoneCall , bool ) {
value , ok := (PhoneCallClass (p )).(NotEmptyPhoneCall )
return value , ok
}
func (p *PhoneCall ) AsNotEmpty () (NotEmptyPhoneCall , bool ) {
value , ok := (PhoneCallClass (p )).(NotEmptyPhoneCall )
return value , ok
}
func (p *PhoneCallDiscarded ) AsNotEmpty () (NotEmptyPhoneCall , bool ) {
value , ok := (PhoneCallClass (p )).(NotEmptyPhoneCall )
return value , ok
}
func DecodePhoneCall (buf *bin .Buffer ) (PhoneCallClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PhoneCallEmptyTypeID :
v := PhoneCallEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , err )
}
return &v , nil
case PhoneCallWaitingTypeID :
v := PhoneCallWaiting {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , err )
}
return &v , nil
case PhoneCallRequestedTypeID :
v := PhoneCallRequested {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , err )
}
return &v , nil
case PhoneCallAcceptedTypeID :
v := PhoneCallAccepted {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , err )
}
return &v , nil
case PhoneCallTypeID :
v := PhoneCall {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , err )
}
return &v , nil
case PhoneCallDiscardedTypeID :
v := PhoneCallDiscarded {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PhoneCallClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PhoneCallBox struct {
PhoneCall PhoneCallClass
}
func (b *PhoneCallBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PhoneCallBox to nil" )
}
v , err := DecodePhoneCall (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .PhoneCall = v
return nil
}
func (b *PhoneCallBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .PhoneCall == nil {
return fmt .Errorf ("unable to encode PhoneCallClass as nil" )
}
return b .PhoneCall .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 .