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 NotifyPeer struct {
Peer PeerClass
}
const NotifyPeerTypeID = 0x9fd40bd8
func (n NotifyPeer ) construct () NotifyPeerClass { return &n }
var (
_ bin .Encoder = &NotifyPeer {}
_ bin .Decoder = &NotifyPeer {}
_ bin .BareEncoder = &NotifyPeer {}
_ bin .BareDecoder = &NotifyPeer {}
_ NotifyPeerClass = &NotifyPeer {}
)
func (n *NotifyPeer ) Zero () bool {
if n == nil {
return true
}
if !(n .Peer == nil ) {
return false
}
return true
}
func (n *NotifyPeer ) String () string {
if n == nil {
return "NotifyPeer(nil)"
}
type Alias NotifyPeer
return fmt .Sprintf ("NotifyPeer%+v" , Alias (*n ))
}
func (n *NotifyPeer ) FillFrom (from interface {
GetPeer () (value PeerClass )
}) {
n .Peer = from .GetPeer ()
}
func (*NotifyPeer ) TypeID () uint32 {
return NotifyPeerTypeID
}
func (*NotifyPeer ) TypeName () string {
return "notifyPeer"
}
func (n *NotifyPeer ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "notifyPeer" ,
ID : NotifyPeerTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
}
return typ
}
func (n *NotifyPeer ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyPeer#9fd40bd8 as nil" )
}
b .PutID (NotifyPeerTypeID )
return n .EncodeBare (b )
}
func (n *NotifyPeer ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyPeer#9fd40bd8 as nil" )
}
if n .Peer == nil {
return fmt .Errorf ("unable to encode notifyPeer#9fd40bd8: field peer is nil" )
}
if err := n .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode notifyPeer#9fd40bd8: field peer: %w" , err )
}
return nil
}
func (n *NotifyPeer ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyPeer#9fd40bd8 to nil" )
}
if err := b .ConsumeID (NotifyPeerTypeID ); err != nil {
return fmt .Errorf ("unable to decode notifyPeer#9fd40bd8: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NotifyPeer ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyPeer#9fd40bd8 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode notifyPeer#9fd40bd8: field peer: %w" , err )
}
n .Peer = value
}
return nil
}
func (n *NotifyPeer ) GetPeer () (value PeerClass ) {
if n == nil {
return
}
return n .Peer
}
type NotifyUsers struct {
}
const NotifyUsersTypeID = 0xb4c83b4c
func (n NotifyUsers ) construct () NotifyPeerClass { return &n }
var (
_ bin .Encoder = &NotifyUsers {}
_ bin .Decoder = &NotifyUsers {}
_ bin .BareEncoder = &NotifyUsers {}
_ bin .BareDecoder = &NotifyUsers {}
_ NotifyPeerClass = &NotifyUsers {}
)
func (n *NotifyUsers ) Zero () bool {
if n == nil {
return true
}
return true
}
func (n *NotifyUsers ) String () string {
if n == nil {
return "NotifyUsers(nil)"
}
type Alias NotifyUsers
return fmt .Sprintf ("NotifyUsers%+v" , Alias (*n ))
}
func (*NotifyUsers ) TypeID () uint32 {
return NotifyUsersTypeID
}
func (*NotifyUsers ) TypeName () string {
return "notifyUsers"
}
func (n *NotifyUsers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "notifyUsers" ,
ID : NotifyUsersTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (n *NotifyUsers ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyUsers#b4c83b4c as nil" )
}
b .PutID (NotifyUsersTypeID )
return n .EncodeBare (b )
}
func (n *NotifyUsers ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyUsers#b4c83b4c as nil" )
}
return nil
}
func (n *NotifyUsers ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyUsers#b4c83b4c to nil" )
}
if err := b .ConsumeID (NotifyUsersTypeID ); err != nil {
return fmt .Errorf ("unable to decode notifyUsers#b4c83b4c: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NotifyUsers ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyUsers#b4c83b4c to nil" )
}
return nil
}
type NotifyChats struct {
}
const NotifyChatsTypeID = 0xc007cec3
func (n NotifyChats ) construct () NotifyPeerClass { return &n }
var (
_ bin .Encoder = &NotifyChats {}
_ bin .Decoder = &NotifyChats {}
_ bin .BareEncoder = &NotifyChats {}
_ bin .BareDecoder = &NotifyChats {}
_ NotifyPeerClass = &NotifyChats {}
)
func (n *NotifyChats ) Zero () bool {
if n == nil {
return true
}
return true
}
func (n *NotifyChats ) String () string {
if n == nil {
return "NotifyChats(nil)"
}
type Alias NotifyChats
return fmt .Sprintf ("NotifyChats%+v" , Alias (*n ))
}
func (*NotifyChats ) TypeID () uint32 {
return NotifyChatsTypeID
}
func (*NotifyChats ) TypeName () string {
return "notifyChats"
}
func (n *NotifyChats ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "notifyChats" ,
ID : NotifyChatsTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (n *NotifyChats ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyChats#c007cec3 as nil" )
}
b .PutID (NotifyChatsTypeID )
return n .EncodeBare (b )
}
func (n *NotifyChats ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyChats#c007cec3 as nil" )
}
return nil
}
func (n *NotifyChats ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyChats#c007cec3 to nil" )
}
if err := b .ConsumeID (NotifyChatsTypeID ); err != nil {
return fmt .Errorf ("unable to decode notifyChats#c007cec3: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NotifyChats ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyChats#c007cec3 to nil" )
}
return nil
}
type NotifyBroadcasts struct {
}
const NotifyBroadcastsTypeID = 0xd612e8ef
func (n NotifyBroadcasts ) construct () NotifyPeerClass { return &n }
var (
_ bin .Encoder = &NotifyBroadcasts {}
_ bin .Decoder = &NotifyBroadcasts {}
_ bin .BareEncoder = &NotifyBroadcasts {}
_ bin .BareDecoder = &NotifyBroadcasts {}
_ NotifyPeerClass = &NotifyBroadcasts {}
)
func (n *NotifyBroadcasts ) Zero () bool {
if n == nil {
return true
}
return true
}
func (n *NotifyBroadcasts ) String () string {
if n == nil {
return "NotifyBroadcasts(nil)"
}
type Alias NotifyBroadcasts
return fmt .Sprintf ("NotifyBroadcasts%+v" , Alias (*n ))
}
func (*NotifyBroadcasts ) TypeID () uint32 {
return NotifyBroadcastsTypeID
}
func (*NotifyBroadcasts ) TypeName () string {
return "notifyBroadcasts"
}
func (n *NotifyBroadcasts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "notifyBroadcasts" ,
ID : NotifyBroadcastsTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (n *NotifyBroadcasts ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyBroadcasts#d612e8ef as nil" )
}
b .PutID (NotifyBroadcastsTypeID )
return n .EncodeBare (b )
}
func (n *NotifyBroadcasts ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyBroadcasts#d612e8ef as nil" )
}
return nil
}
func (n *NotifyBroadcasts ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyBroadcasts#d612e8ef to nil" )
}
if err := b .ConsumeID (NotifyBroadcastsTypeID ); err != nil {
return fmt .Errorf ("unable to decode notifyBroadcasts#d612e8ef: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NotifyBroadcasts ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyBroadcasts#d612e8ef to nil" )
}
return nil
}
type NotifyForumTopic struct {
Peer PeerClass
TopMsgID int
}
const NotifyForumTopicTypeID = 0x226e6308
func (n NotifyForumTopic ) construct () NotifyPeerClass { return &n }
var (
_ bin .Encoder = &NotifyForumTopic {}
_ bin .Decoder = &NotifyForumTopic {}
_ bin .BareEncoder = &NotifyForumTopic {}
_ bin .BareDecoder = &NotifyForumTopic {}
_ NotifyPeerClass = &NotifyForumTopic {}
)
func (n *NotifyForumTopic ) Zero () bool {
if n == nil {
return true
}
if !(n .Peer == nil ) {
return false
}
if !(n .TopMsgID == 0 ) {
return false
}
return true
}
func (n *NotifyForumTopic ) String () string {
if n == nil {
return "NotifyForumTopic(nil)"
}
type Alias NotifyForumTopic
return fmt .Sprintf ("NotifyForumTopic%+v" , Alias (*n ))
}
func (n *NotifyForumTopic ) FillFrom (from interface {
GetPeer () (value PeerClass )
GetTopMsgID () (value int )
}) {
n .Peer = from .GetPeer ()
n .TopMsgID = from .GetTopMsgID ()
}
func (*NotifyForumTopic ) TypeID () uint32 {
return NotifyForumTopicTypeID
}
func (*NotifyForumTopic ) TypeName () string {
return "notifyForumTopic"
}
func (n *NotifyForumTopic ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "notifyForumTopic" ,
ID : NotifyForumTopicTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "TopMsgID" ,
SchemaName : "top_msg_id" ,
},
}
return typ
}
func (n *NotifyForumTopic ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyForumTopic#226e6308 as nil" )
}
b .PutID (NotifyForumTopicTypeID )
return n .EncodeBare (b )
}
func (n *NotifyForumTopic ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode notifyForumTopic#226e6308 as nil" )
}
if n .Peer == nil {
return fmt .Errorf ("unable to encode notifyForumTopic#226e6308: field peer is nil" )
}
if err := n .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode notifyForumTopic#226e6308: field peer: %w" , err )
}
b .PutInt (n .TopMsgID )
return nil
}
func (n *NotifyForumTopic ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyForumTopic#226e6308 to nil" )
}
if err := b .ConsumeID (NotifyForumTopicTypeID ); err != nil {
return fmt .Errorf ("unable to decode notifyForumTopic#226e6308: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NotifyForumTopic ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode notifyForumTopic#226e6308 to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode notifyForumTopic#226e6308: field peer: %w" , err )
}
n .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode notifyForumTopic#226e6308: field top_msg_id: %w" , err )
}
n .TopMsgID = value
}
return nil
}
func (n *NotifyForumTopic ) GetPeer () (value PeerClass ) {
if n == nil {
return
}
return n .Peer
}
func (n *NotifyForumTopic ) GetTopMsgID () (value int ) {
if n == nil {
return
}
return n .TopMsgID
}
const NotifyPeerClassName = "NotifyPeer"
type NotifyPeerClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () NotifyPeerClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeNotifyPeer (buf *bin .Buffer ) (NotifyPeerClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case NotifyPeerTypeID :
v := NotifyPeer {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode NotifyPeerClass: %w" , err )
}
return &v , nil
case NotifyUsersTypeID :
v := NotifyUsers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode NotifyPeerClass: %w" , err )
}
return &v , nil
case NotifyChatsTypeID :
v := NotifyChats {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode NotifyPeerClass: %w" , err )
}
return &v , nil
case NotifyBroadcastsTypeID :
v := NotifyBroadcasts {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode NotifyPeerClass: %w" , err )
}
return &v , nil
case NotifyForumTopicTypeID :
v := NotifyForumTopic {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode NotifyPeerClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode NotifyPeerClass: %w" , bin .NewUnexpectedID (id ))
}
}
type NotifyPeerBox struct {
NotifyPeer NotifyPeerClass
}
func (b *NotifyPeerBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode NotifyPeerBox to nil" )
}
v , err := DecodeNotifyPeer (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .NotifyPeer = v
return nil
}
func (b *NotifyPeerBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .NotifyPeer == nil {
return fmt .Errorf ("unable to encode NotifyPeerClass as nil" )
}
return b .NotifyPeer .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 .