package mt
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 BadMsgNotification struct {
BadMsgID int64
BadMsgSeqno int
ErrorCode int
}
const BadMsgNotificationTypeID = 0xa7eff811
func (b BadMsgNotification ) construct () BadMsgNotificationClass { return &b }
var (
_ bin .Encoder = &BadMsgNotification {}
_ bin .Decoder = &BadMsgNotification {}
_ bin .BareEncoder = &BadMsgNotification {}
_ bin .BareDecoder = &BadMsgNotification {}
_ BadMsgNotificationClass = &BadMsgNotification {}
)
func (b *BadMsgNotification ) Zero () bool {
if b == nil {
return true
}
if !(b .BadMsgID == 0 ) {
return false
}
if !(b .BadMsgSeqno == 0 ) {
return false
}
if !(b .ErrorCode == 0 ) {
return false
}
return true
}
func (b *BadMsgNotification ) String () string {
if b == nil {
return "BadMsgNotification(nil)"
}
type Alias BadMsgNotification
return fmt .Sprintf ("BadMsgNotification%+v" , Alias (*b ))
}
func (*BadMsgNotification ) TypeID () uint32 {
return BadMsgNotificationTypeID
}
func (*BadMsgNotification ) TypeName () string {
return "bad_msg_notification"
}
func (b *BadMsgNotification ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bad_msg_notification" ,
ID : BadMsgNotificationTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BadMsgID" ,
SchemaName : "bad_msg_id" ,
},
{
Name : "BadMsgSeqno" ,
SchemaName : "bad_msg_seqno" ,
},
{
Name : "ErrorCode" ,
SchemaName : "error_code" ,
},
}
return typ
}
func (b *BadMsgNotification ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode bad_msg_notification#a7eff811 as nil" )
}
buf .PutID (BadMsgNotificationTypeID )
return b .EncodeBare (buf )
}
func (b *BadMsgNotification ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode bad_msg_notification#a7eff811 as nil" )
}
buf .PutLong (b .BadMsgID )
buf .PutInt (b .BadMsgSeqno )
buf .PutInt (b .ErrorCode )
return nil
}
func (b *BadMsgNotification ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode bad_msg_notification#a7eff811 to nil" )
}
if err := buf .ConsumeID (BadMsgNotificationTypeID ); err != nil {
return fmt .Errorf ("unable to decode bad_msg_notification#a7eff811: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BadMsgNotification ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode bad_msg_notification#a7eff811 to nil" )
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode bad_msg_notification#a7eff811: field bad_msg_id: %w" , err )
}
b .BadMsgID = value
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode bad_msg_notification#a7eff811: field bad_msg_seqno: %w" , err )
}
b .BadMsgSeqno = value
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode bad_msg_notification#a7eff811: field error_code: %w" , err )
}
b .ErrorCode = value
}
return nil
}
func (b *BadMsgNotification ) GetBadMsgID () (value int64 ) {
if b == nil {
return
}
return b .BadMsgID
}
func (b *BadMsgNotification ) GetBadMsgSeqno () (value int ) {
if b == nil {
return
}
return b .BadMsgSeqno
}
func (b *BadMsgNotification ) GetErrorCode () (value int ) {
if b == nil {
return
}
return b .ErrorCode
}
type BadServerSalt struct {
BadMsgID int64
BadMsgSeqno int
ErrorCode int
NewServerSalt int64
}
const BadServerSaltTypeID = 0xedab447b
func (b BadServerSalt ) construct () BadMsgNotificationClass { return &b }
var (
_ bin .Encoder = &BadServerSalt {}
_ bin .Decoder = &BadServerSalt {}
_ bin .BareEncoder = &BadServerSalt {}
_ bin .BareDecoder = &BadServerSalt {}
_ BadMsgNotificationClass = &BadServerSalt {}
)
func (b *BadServerSalt ) Zero () bool {
if b == nil {
return true
}
if !(b .BadMsgID == 0 ) {
return false
}
if !(b .BadMsgSeqno == 0 ) {
return false
}
if !(b .ErrorCode == 0 ) {
return false
}
if !(b .NewServerSalt == 0 ) {
return false
}
return true
}
func (b *BadServerSalt ) String () string {
if b == nil {
return "BadServerSalt(nil)"
}
type Alias BadServerSalt
return fmt .Sprintf ("BadServerSalt%+v" , Alias (*b ))
}
func (*BadServerSalt ) TypeID () uint32 {
return BadServerSaltTypeID
}
func (*BadServerSalt ) TypeName () string {
return "bad_server_salt"
}
func (b *BadServerSalt ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bad_server_salt" ,
ID : BadServerSaltTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BadMsgID" ,
SchemaName : "bad_msg_id" ,
},
{
Name : "BadMsgSeqno" ,
SchemaName : "bad_msg_seqno" ,
},
{
Name : "ErrorCode" ,
SchemaName : "error_code" ,
},
{
Name : "NewServerSalt" ,
SchemaName : "new_server_salt" ,
},
}
return typ
}
func (b *BadServerSalt ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode bad_server_salt#edab447b as nil" )
}
buf .PutID (BadServerSaltTypeID )
return b .EncodeBare (buf )
}
func (b *BadServerSalt ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode bad_server_salt#edab447b as nil" )
}
buf .PutLong (b .BadMsgID )
buf .PutInt (b .BadMsgSeqno )
buf .PutInt (b .ErrorCode )
buf .PutLong (b .NewServerSalt )
return nil
}
func (b *BadServerSalt ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode bad_server_salt#edab447b to nil" )
}
if err := buf .ConsumeID (BadServerSaltTypeID ); err != nil {
return fmt .Errorf ("unable to decode bad_server_salt#edab447b: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BadServerSalt ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode bad_server_salt#edab447b to nil" )
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode bad_server_salt#edab447b: field bad_msg_id: %w" , err )
}
b .BadMsgID = value
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode bad_server_salt#edab447b: field bad_msg_seqno: %w" , err )
}
b .BadMsgSeqno = value
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode bad_server_salt#edab447b: field error_code: %w" , err )
}
b .ErrorCode = value
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode bad_server_salt#edab447b: field new_server_salt: %w" , err )
}
b .NewServerSalt = value
}
return nil
}
func (b *BadServerSalt ) GetBadMsgID () (value int64 ) {
if b == nil {
return
}
return b .BadMsgID
}
func (b *BadServerSalt ) GetBadMsgSeqno () (value int ) {
if b == nil {
return
}
return b .BadMsgSeqno
}
func (b *BadServerSalt ) GetErrorCode () (value int ) {
if b == nil {
return
}
return b .ErrorCode
}
func (b *BadServerSalt ) GetNewServerSalt () (value int64 ) {
if b == nil {
return
}
return b .NewServerSalt
}
const BadMsgNotificationClassName = "BadMsgNotification"
type BadMsgNotificationClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () BadMsgNotificationClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetBadMsgID () (value int64 )
GetBadMsgSeqno () (value int )
GetErrorCode () (value int )
}
func DecodeBadMsgNotification (buf *bin .Buffer ) (BadMsgNotificationClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case BadMsgNotificationTypeID :
v := BadMsgNotification {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BadMsgNotificationClass: %w" , err )
}
return &v , nil
case BadServerSaltTypeID :
v := BadServerSalt {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BadMsgNotificationClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode BadMsgNotificationClass: %w" , bin .NewUnexpectedID (id ))
}
}
type BadMsgNotificationBox struct {
BadMsgNotification BadMsgNotificationClass
}
func (b *BadMsgNotificationBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode BadMsgNotificationBox to nil" )
}
v , err := DecodeBadMsgNotification (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .BadMsgNotification = v
return nil
}
func (b *BadMsgNotificationBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .BadMsgNotification == nil {
return fmt .Errorf ("unable to encode BadMsgNotificationClass as nil" )
}
return b .BadMsgNotification .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 .