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 PeerBlocked struct {
PeerID PeerClass
Date int
}
const PeerBlockedTypeID = 0xe8fd8014
var (
_ bin .Encoder = &PeerBlocked {}
_ bin .Decoder = &PeerBlocked {}
_ bin .BareEncoder = &PeerBlocked {}
_ bin .BareDecoder = &PeerBlocked {}
)
func (p *PeerBlocked ) Zero () bool {
if p == nil {
return true
}
if !(p .PeerID == nil ) {
return false
}
if !(p .Date == 0 ) {
return false
}
return true
}
func (p *PeerBlocked ) String () string {
if p == nil {
return "PeerBlocked(nil)"
}
type Alias PeerBlocked
return fmt .Sprintf ("PeerBlocked%+v" , Alias (*p ))
}
func (p *PeerBlocked ) FillFrom (from interface {
GetPeerID () (value PeerClass )
GetDate () (value int )
}) {
p .PeerID = from .GetPeerID ()
p .Date = from .GetDate ()
}
func (*PeerBlocked ) TypeID () uint32 {
return PeerBlockedTypeID
}
func (*PeerBlocked ) TypeName () string {
return "peerBlocked"
}
func (p *PeerBlocked ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "peerBlocked" ,
ID : PeerBlockedTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PeerID" ,
SchemaName : "peer_id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
}
return typ
}
func (p *PeerBlocked ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode peerBlocked#e8fd8014 as nil" )
}
b .PutID (PeerBlockedTypeID )
return p .EncodeBare (b )
}
func (p *PeerBlocked ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode peerBlocked#e8fd8014 as nil" )
}
if p .PeerID == nil {
return fmt .Errorf ("unable to encode peerBlocked#e8fd8014: field peer_id is nil" )
}
if err := p .PeerID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode peerBlocked#e8fd8014: field peer_id: %w" , err )
}
b .PutInt (p .Date )
return nil
}
func (p *PeerBlocked ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode peerBlocked#e8fd8014 to nil" )
}
if err := b .ConsumeID (PeerBlockedTypeID ); err != nil {
return fmt .Errorf ("unable to decode peerBlocked#e8fd8014: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PeerBlocked ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode peerBlocked#e8fd8014 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode peerBlocked#e8fd8014: field peer_id: %w" , err )
}
p .PeerID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode peerBlocked#e8fd8014: field date: %w" , err )
}
p .Date = value
}
return nil
}
func (p *PeerBlocked ) GetPeerID () (value PeerClass ) {
if p == nil {
return
}
return p .PeerID
}
func (p *PeerBlocked ) GetDate () (value int ) {
if p == nil {
return
}
return p .Date
}
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 .