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