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 PingDelayDisconnectRequest struct {
PingID int64
DisconnectDelay int
}
const PingDelayDisconnectRequestTypeID = 0xf3427b8c
var (
_ bin .Encoder = &PingDelayDisconnectRequest {}
_ bin .Decoder = &PingDelayDisconnectRequest {}
_ bin .BareEncoder = &PingDelayDisconnectRequest {}
_ bin .BareDecoder = &PingDelayDisconnectRequest {}
)
func (p *PingDelayDisconnectRequest ) Zero () bool {
if p == nil {
return true
}
if !(p .PingID == 0 ) {
return false
}
if !(p .DisconnectDelay == 0 ) {
return false
}
return true
}
func (p *PingDelayDisconnectRequest ) String () string {
if p == nil {
return "PingDelayDisconnectRequest(nil)"
}
type Alias PingDelayDisconnectRequest
return fmt .Sprintf ("PingDelayDisconnectRequest%+v" , Alias (*p ))
}
func (*PingDelayDisconnectRequest ) TypeID () uint32 {
return PingDelayDisconnectRequestTypeID
}
func (*PingDelayDisconnectRequest ) TypeName () string {
return "ping_delay_disconnect"
}
func (p *PingDelayDisconnectRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "ping_delay_disconnect" ,
ID : PingDelayDisconnectRequestTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PingID" ,
SchemaName : "ping_id" ,
},
{
Name : "DisconnectDelay" ,
SchemaName : "disconnect_delay" ,
},
}
return typ
}
func (p *PingDelayDisconnectRequest ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode ping_delay_disconnect#f3427b8c as nil" )
}
b .PutID (PingDelayDisconnectRequestTypeID )
return p .EncodeBare (b )
}
func (p *PingDelayDisconnectRequest ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode ping_delay_disconnect#f3427b8c as nil" )
}
b .PutLong (p .PingID )
b .PutInt (p .DisconnectDelay )
return nil
}
func (p *PingDelayDisconnectRequest ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode ping_delay_disconnect#f3427b8c to nil" )
}
if err := b .ConsumeID (PingDelayDisconnectRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode ping_delay_disconnect#f3427b8c: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PingDelayDisconnectRequest ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode ping_delay_disconnect#f3427b8c to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode ping_delay_disconnect#f3427b8c: field ping_id: %w" , err )
}
p .PingID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode ping_delay_disconnect#f3427b8c: field disconnect_delay: %w" , err )
}
p .DisconnectDelay = value
}
return nil
}
func (p *PingDelayDisconnectRequest ) GetPingID () (value int64 ) {
if p == nil {
return
}
return p .PingID
}
func (p *PingDelayDisconnectRequest ) GetDisconnectDelay () (value int ) {
if p == nil {
return
}
return p .DisconnectDelay
}
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 .