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 PhoneCallDiscardReasonMissed struct {
}
const PhoneCallDiscardReasonMissedTypeID = 0x85e42301
func (p PhoneCallDiscardReasonMissed ) construct () PhoneCallDiscardReasonClass { return &p }
var (
_ bin .Encoder = &PhoneCallDiscardReasonMissed {}
_ bin .Decoder = &PhoneCallDiscardReasonMissed {}
_ bin .BareEncoder = &PhoneCallDiscardReasonMissed {}
_ bin .BareDecoder = &PhoneCallDiscardReasonMissed {}
_ PhoneCallDiscardReasonClass = &PhoneCallDiscardReasonMissed {}
)
func (p *PhoneCallDiscardReasonMissed ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PhoneCallDiscardReasonMissed ) String () string {
if p == nil {
return "PhoneCallDiscardReasonMissed(nil)"
}
type Alias PhoneCallDiscardReasonMissed
return fmt .Sprintf ("PhoneCallDiscardReasonMissed%+v" , Alias (*p ))
}
func (*PhoneCallDiscardReasonMissed ) TypeID () uint32 {
return PhoneCallDiscardReasonMissedTypeID
}
func (*PhoneCallDiscardReasonMissed ) TypeName () string {
return "phoneCallDiscardReasonMissed"
}
func (p *PhoneCallDiscardReasonMissed ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallDiscardReasonMissed" ,
ID : PhoneCallDiscardReasonMissedTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PhoneCallDiscardReasonMissed ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonMissed#85e42301 as nil" )
}
b .PutID (PhoneCallDiscardReasonMissedTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallDiscardReasonMissed ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonMissed#85e42301 as nil" )
}
return nil
}
func (p *PhoneCallDiscardReasonMissed ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonMissed#85e42301 to nil" )
}
if err := b .ConsumeID (PhoneCallDiscardReasonMissedTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscardReasonMissed#85e42301: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallDiscardReasonMissed ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonMissed#85e42301 to nil" )
}
return nil
}
type PhoneCallDiscardReasonDisconnect struct {
}
const PhoneCallDiscardReasonDisconnectTypeID = 0xe095c1a0
func (p PhoneCallDiscardReasonDisconnect ) construct () PhoneCallDiscardReasonClass { return &p }
var (
_ bin .Encoder = &PhoneCallDiscardReasonDisconnect {}
_ bin .Decoder = &PhoneCallDiscardReasonDisconnect {}
_ bin .BareEncoder = &PhoneCallDiscardReasonDisconnect {}
_ bin .BareDecoder = &PhoneCallDiscardReasonDisconnect {}
_ PhoneCallDiscardReasonClass = &PhoneCallDiscardReasonDisconnect {}
)
func (p *PhoneCallDiscardReasonDisconnect ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PhoneCallDiscardReasonDisconnect ) String () string {
if p == nil {
return "PhoneCallDiscardReasonDisconnect(nil)"
}
type Alias PhoneCallDiscardReasonDisconnect
return fmt .Sprintf ("PhoneCallDiscardReasonDisconnect%+v" , Alias (*p ))
}
func (*PhoneCallDiscardReasonDisconnect ) TypeID () uint32 {
return PhoneCallDiscardReasonDisconnectTypeID
}
func (*PhoneCallDiscardReasonDisconnect ) TypeName () string {
return "phoneCallDiscardReasonDisconnect"
}
func (p *PhoneCallDiscardReasonDisconnect ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallDiscardReasonDisconnect" ,
ID : PhoneCallDiscardReasonDisconnectTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PhoneCallDiscardReasonDisconnect ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonDisconnect#e095c1a0 as nil" )
}
b .PutID (PhoneCallDiscardReasonDisconnectTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallDiscardReasonDisconnect ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonDisconnect#e095c1a0 as nil" )
}
return nil
}
func (p *PhoneCallDiscardReasonDisconnect ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonDisconnect#e095c1a0 to nil" )
}
if err := b .ConsumeID (PhoneCallDiscardReasonDisconnectTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscardReasonDisconnect#e095c1a0: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallDiscardReasonDisconnect ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonDisconnect#e095c1a0 to nil" )
}
return nil
}
type PhoneCallDiscardReasonHangup struct {
}
const PhoneCallDiscardReasonHangupTypeID = 0x57adc690
func (p PhoneCallDiscardReasonHangup ) construct () PhoneCallDiscardReasonClass { return &p }
var (
_ bin .Encoder = &PhoneCallDiscardReasonHangup {}
_ bin .Decoder = &PhoneCallDiscardReasonHangup {}
_ bin .BareEncoder = &PhoneCallDiscardReasonHangup {}
_ bin .BareDecoder = &PhoneCallDiscardReasonHangup {}
_ PhoneCallDiscardReasonClass = &PhoneCallDiscardReasonHangup {}
)
func (p *PhoneCallDiscardReasonHangup ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PhoneCallDiscardReasonHangup ) String () string {
if p == nil {
return "PhoneCallDiscardReasonHangup(nil)"
}
type Alias PhoneCallDiscardReasonHangup
return fmt .Sprintf ("PhoneCallDiscardReasonHangup%+v" , Alias (*p ))
}
func (*PhoneCallDiscardReasonHangup ) TypeID () uint32 {
return PhoneCallDiscardReasonHangupTypeID
}
func (*PhoneCallDiscardReasonHangup ) TypeName () string {
return "phoneCallDiscardReasonHangup"
}
func (p *PhoneCallDiscardReasonHangup ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallDiscardReasonHangup" ,
ID : PhoneCallDiscardReasonHangupTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PhoneCallDiscardReasonHangup ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonHangup#57adc690 as nil" )
}
b .PutID (PhoneCallDiscardReasonHangupTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallDiscardReasonHangup ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonHangup#57adc690 as nil" )
}
return nil
}
func (p *PhoneCallDiscardReasonHangup ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonHangup#57adc690 to nil" )
}
if err := b .ConsumeID (PhoneCallDiscardReasonHangupTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscardReasonHangup#57adc690: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallDiscardReasonHangup ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonHangup#57adc690 to nil" )
}
return nil
}
type PhoneCallDiscardReasonBusy struct {
}
const PhoneCallDiscardReasonBusyTypeID = 0xfaf7e8c9
func (p PhoneCallDiscardReasonBusy ) construct () PhoneCallDiscardReasonClass { return &p }
var (
_ bin .Encoder = &PhoneCallDiscardReasonBusy {}
_ bin .Decoder = &PhoneCallDiscardReasonBusy {}
_ bin .BareEncoder = &PhoneCallDiscardReasonBusy {}
_ bin .BareDecoder = &PhoneCallDiscardReasonBusy {}
_ PhoneCallDiscardReasonClass = &PhoneCallDiscardReasonBusy {}
)
func (p *PhoneCallDiscardReasonBusy ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PhoneCallDiscardReasonBusy ) String () string {
if p == nil {
return "PhoneCallDiscardReasonBusy(nil)"
}
type Alias PhoneCallDiscardReasonBusy
return fmt .Sprintf ("PhoneCallDiscardReasonBusy%+v" , Alias (*p ))
}
func (*PhoneCallDiscardReasonBusy ) TypeID () uint32 {
return PhoneCallDiscardReasonBusyTypeID
}
func (*PhoneCallDiscardReasonBusy ) TypeName () string {
return "phoneCallDiscardReasonBusy"
}
func (p *PhoneCallDiscardReasonBusy ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "phoneCallDiscardReasonBusy" ,
ID : PhoneCallDiscardReasonBusyTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PhoneCallDiscardReasonBusy ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonBusy#faf7e8c9 as nil" )
}
b .PutID (PhoneCallDiscardReasonBusyTypeID )
return p .EncodeBare (b )
}
func (p *PhoneCallDiscardReasonBusy ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode phoneCallDiscardReasonBusy#faf7e8c9 as nil" )
}
return nil
}
func (p *PhoneCallDiscardReasonBusy ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonBusy#faf7e8c9 to nil" )
}
if err := b .ConsumeID (PhoneCallDiscardReasonBusyTypeID ); err != nil {
return fmt .Errorf ("unable to decode phoneCallDiscardReasonBusy#faf7e8c9: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PhoneCallDiscardReasonBusy ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode phoneCallDiscardReasonBusy#faf7e8c9 to nil" )
}
return nil
}
const PhoneCallDiscardReasonClassName = "PhoneCallDiscardReason"
type PhoneCallDiscardReasonClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PhoneCallDiscardReasonClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodePhoneCallDiscardReason (buf *bin .Buffer ) (PhoneCallDiscardReasonClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PhoneCallDiscardReasonMissedTypeID :
v := PhoneCallDiscardReasonMissed {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallDiscardReasonClass: %w" , err )
}
return &v , nil
case PhoneCallDiscardReasonDisconnectTypeID :
v := PhoneCallDiscardReasonDisconnect {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallDiscardReasonClass: %w" , err )
}
return &v , nil
case PhoneCallDiscardReasonHangupTypeID :
v := PhoneCallDiscardReasonHangup {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallDiscardReasonClass: %w" , err )
}
return &v , nil
case PhoneCallDiscardReasonBusyTypeID :
v := PhoneCallDiscardReasonBusy {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PhoneCallDiscardReasonClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PhoneCallDiscardReasonClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PhoneCallDiscardReasonBox struct {
PhoneCallDiscardReason PhoneCallDiscardReasonClass
}
func (b *PhoneCallDiscardReasonBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PhoneCallDiscardReasonBox to nil" )
}
v , err := DecodePhoneCallDiscardReason (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .PhoneCallDiscardReason = v
return nil
}
func (b *PhoneCallDiscardReasonBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .PhoneCallDiscardReason == nil {
return fmt .Errorf ("unable to encode PhoneCallDiscardReasonClass as nil" )
}
return b .PhoneCallDiscardReason .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 .