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 InputNotifyPeer struct {
Peer InputPeerClass
}
const InputNotifyPeerTypeID = 0xb8bc5b0c
func (i InputNotifyPeer ) construct () InputNotifyPeerClass { return &i }
var (
_ bin .Encoder = &InputNotifyPeer {}
_ bin .Decoder = &InputNotifyPeer {}
_ bin .BareEncoder = &InputNotifyPeer {}
_ bin .BareDecoder = &InputNotifyPeer {}
_ InputNotifyPeerClass = &InputNotifyPeer {}
)
func (i *InputNotifyPeer ) Zero () bool {
if i == nil {
return true
}
if !(i .Peer == nil ) {
return false
}
return true
}
func (i *InputNotifyPeer ) String () string {
if i == nil {
return "InputNotifyPeer(nil)"
}
type Alias InputNotifyPeer
return fmt .Sprintf ("InputNotifyPeer%+v" , Alias (*i ))
}
func (i *InputNotifyPeer ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
}) {
i .Peer = from .GetPeer ()
}
func (*InputNotifyPeer ) TypeID () uint32 {
return InputNotifyPeerTypeID
}
func (*InputNotifyPeer ) TypeName () string {
return "inputNotifyPeer"
}
func (i *InputNotifyPeer ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputNotifyPeer" ,
ID : InputNotifyPeerTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
}
return typ
}
func (i *InputNotifyPeer ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyPeer#b8bc5b0c as nil" )
}
b .PutID (InputNotifyPeerTypeID )
return i .EncodeBare (b )
}
func (i *InputNotifyPeer ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyPeer#b8bc5b0c as nil" )
}
if i .Peer == nil {
return fmt .Errorf ("unable to encode inputNotifyPeer#b8bc5b0c: field peer is nil" )
}
if err := i .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputNotifyPeer#b8bc5b0c: field peer: %w" , err )
}
return nil
}
func (i *InputNotifyPeer ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyPeer#b8bc5b0c to nil" )
}
if err := b .ConsumeID (InputNotifyPeerTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputNotifyPeer#b8bc5b0c: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputNotifyPeer ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyPeer#b8bc5b0c to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode inputNotifyPeer#b8bc5b0c: field peer: %w" , err )
}
i .Peer = value
}
return nil
}
func (i *InputNotifyPeer ) GetPeer () (value InputPeerClass ) {
if i == nil {
return
}
return i .Peer
}
type InputNotifyUsers struct {
}
const InputNotifyUsersTypeID = 0x193b4417
func (i InputNotifyUsers ) construct () InputNotifyPeerClass { return &i }
var (
_ bin .Encoder = &InputNotifyUsers {}
_ bin .Decoder = &InputNotifyUsers {}
_ bin .BareEncoder = &InputNotifyUsers {}
_ bin .BareDecoder = &InputNotifyUsers {}
_ InputNotifyPeerClass = &InputNotifyUsers {}
)
func (i *InputNotifyUsers ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputNotifyUsers ) String () string {
if i == nil {
return "InputNotifyUsers(nil)"
}
type Alias InputNotifyUsers
return fmt .Sprintf ("InputNotifyUsers%+v" , Alias (*i ))
}
func (*InputNotifyUsers ) TypeID () uint32 {
return InputNotifyUsersTypeID
}
func (*InputNotifyUsers ) TypeName () string {
return "inputNotifyUsers"
}
func (i *InputNotifyUsers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputNotifyUsers" ,
ID : InputNotifyUsersTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputNotifyUsers ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyUsers#193b4417 as nil" )
}
b .PutID (InputNotifyUsersTypeID )
return i .EncodeBare (b )
}
func (i *InputNotifyUsers ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyUsers#193b4417 as nil" )
}
return nil
}
func (i *InputNotifyUsers ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyUsers#193b4417 to nil" )
}
if err := b .ConsumeID (InputNotifyUsersTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputNotifyUsers#193b4417: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputNotifyUsers ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyUsers#193b4417 to nil" )
}
return nil
}
type InputNotifyChats struct {
}
const InputNotifyChatsTypeID = 0x4a95e84e
func (i InputNotifyChats ) construct () InputNotifyPeerClass { return &i }
var (
_ bin .Encoder = &InputNotifyChats {}
_ bin .Decoder = &InputNotifyChats {}
_ bin .BareEncoder = &InputNotifyChats {}
_ bin .BareDecoder = &InputNotifyChats {}
_ InputNotifyPeerClass = &InputNotifyChats {}
)
func (i *InputNotifyChats ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputNotifyChats ) String () string {
if i == nil {
return "InputNotifyChats(nil)"
}
type Alias InputNotifyChats
return fmt .Sprintf ("InputNotifyChats%+v" , Alias (*i ))
}
func (*InputNotifyChats ) TypeID () uint32 {
return InputNotifyChatsTypeID
}
func (*InputNotifyChats ) TypeName () string {
return "inputNotifyChats"
}
func (i *InputNotifyChats ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputNotifyChats" ,
ID : InputNotifyChatsTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputNotifyChats ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyChats#4a95e84e as nil" )
}
b .PutID (InputNotifyChatsTypeID )
return i .EncodeBare (b )
}
func (i *InputNotifyChats ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyChats#4a95e84e as nil" )
}
return nil
}
func (i *InputNotifyChats ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyChats#4a95e84e to nil" )
}
if err := b .ConsumeID (InputNotifyChatsTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputNotifyChats#4a95e84e: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputNotifyChats ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyChats#4a95e84e to nil" )
}
return nil
}
type InputNotifyBroadcasts struct {
}
const InputNotifyBroadcastsTypeID = 0xb1db7c7e
func (i InputNotifyBroadcasts ) construct () InputNotifyPeerClass { return &i }
var (
_ bin .Encoder = &InputNotifyBroadcasts {}
_ bin .Decoder = &InputNotifyBroadcasts {}
_ bin .BareEncoder = &InputNotifyBroadcasts {}
_ bin .BareDecoder = &InputNotifyBroadcasts {}
_ InputNotifyPeerClass = &InputNotifyBroadcasts {}
)
func (i *InputNotifyBroadcasts ) Zero () bool {
if i == nil {
return true
}
return true
}
func (i *InputNotifyBroadcasts ) String () string {
if i == nil {
return "InputNotifyBroadcasts(nil)"
}
type Alias InputNotifyBroadcasts
return fmt .Sprintf ("InputNotifyBroadcasts%+v" , Alias (*i ))
}
func (*InputNotifyBroadcasts ) TypeID () uint32 {
return InputNotifyBroadcastsTypeID
}
func (*InputNotifyBroadcasts ) TypeName () string {
return "inputNotifyBroadcasts"
}
func (i *InputNotifyBroadcasts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputNotifyBroadcasts" ,
ID : InputNotifyBroadcastsTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (i *InputNotifyBroadcasts ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyBroadcasts#b1db7c7e as nil" )
}
b .PutID (InputNotifyBroadcastsTypeID )
return i .EncodeBare (b )
}
func (i *InputNotifyBroadcasts ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyBroadcasts#b1db7c7e as nil" )
}
return nil
}
func (i *InputNotifyBroadcasts ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyBroadcasts#b1db7c7e to nil" )
}
if err := b .ConsumeID (InputNotifyBroadcastsTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputNotifyBroadcasts#b1db7c7e: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputNotifyBroadcasts ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyBroadcasts#b1db7c7e to nil" )
}
return nil
}
type InputNotifyForumTopic struct {
Peer InputPeerClass
TopMsgID int
}
const InputNotifyForumTopicTypeID = 0x5c467992
func (i InputNotifyForumTopic ) construct () InputNotifyPeerClass { return &i }
var (
_ bin .Encoder = &InputNotifyForumTopic {}
_ bin .Decoder = &InputNotifyForumTopic {}
_ bin .BareEncoder = &InputNotifyForumTopic {}
_ bin .BareDecoder = &InputNotifyForumTopic {}
_ InputNotifyPeerClass = &InputNotifyForumTopic {}
)
func (i *InputNotifyForumTopic ) Zero () bool {
if i == nil {
return true
}
if !(i .Peer == nil ) {
return false
}
if !(i .TopMsgID == 0 ) {
return false
}
return true
}
func (i *InputNotifyForumTopic ) String () string {
if i == nil {
return "InputNotifyForumTopic(nil)"
}
type Alias InputNotifyForumTopic
return fmt .Sprintf ("InputNotifyForumTopic%+v" , Alias (*i ))
}
func (i *InputNotifyForumTopic ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetTopMsgID () (value int )
}) {
i .Peer = from .GetPeer ()
i .TopMsgID = from .GetTopMsgID ()
}
func (*InputNotifyForumTopic ) TypeID () uint32 {
return InputNotifyForumTopicTypeID
}
func (*InputNotifyForumTopic ) TypeName () string {
return "inputNotifyForumTopic"
}
func (i *InputNotifyForumTopic ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputNotifyForumTopic" ,
ID : InputNotifyForumTopicTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "TopMsgID" ,
SchemaName : "top_msg_id" ,
},
}
return typ
}
func (i *InputNotifyForumTopic ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyForumTopic#5c467992 as nil" )
}
b .PutID (InputNotifyForumTopicTypeID )
return i .EncodeBare (b )
}
func (i *InputNotifyForumTopic ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputNotifyForumTopic#5c467992 as nil" )
}
if i .Peer == nil {
return fmt .Errorf ("unable to encode inputNotifyForumTopic#5c467992: field peer is nil" )
}
if err := i .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputNotifyForumTopic#5c467992: field peer: %w" , err )
}
b .PutInt (i .TopMsgID )
return nil
}
func (i *InputNotifyForumTopic ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyForumTopic#5c467992 to nil" )
}
if err := b .ConsumeID (InputNotifyForumTopicTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputNotifyForumTopic#5c467992: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputNotifyForumTopic ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputNotifyForumTopic#5c467992 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode inputNotifyForumTopic#5c467992: field peer: %w" , err )
}
i .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode inputNotifyForumTopic#5c467992: field top_msg_id: %w" , err )
}
i .TopMsgID = value
}
return nil
}
func (i *InputNotifyForumTopic ) GetPeer () (value InputPeerClass ) {
if i == nil {
return
}
return i .Peer
}
func (i *InputNotifyForumTopic ) GetTopMsgID () (value int ) {
if i == nil {
return
}
return i .TopMsgID
}
const InputNotifyPeerClassName = "InputNotifyPeer"
type InputNotifyPeerClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () InputNotifyPeerClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeInputNotifyPeer (buf *bin .Buffer ) (InputNotifyPeerClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case InputNotifyPeerTypeID :
v := InputNotifyPeer {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputNotifyPeerClass: %w" , err )
}
return &v , nil
case InputNotifyUsersTypeID :
v := InputNotifyUsers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputNotifyPeerClass: %w" , err )
}
return &v , nil
case InputNotifyChatsTypeID :
v := InputNotifyChats {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputNotifyPeerClass: %w" , err )
}
return &v , nil
case InputNotifyBroadcastsTypeID :
v := InputNotifyBroadcasts {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputNotifyPeerClass: %w" , err )
}
return &v , nil
case InputNotifyForumTopicTypeID :
v := InputNotifyForumTopic {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode InputNotifyPeerClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode InputNotifyPeerClass: %w" , bin .NewUnexpectedID (id ))
}
}
type InputNotifyPeerBox struct {
InputNotifyPeer InputNotifyPeerClass
}
func (b *InputNotifyPeerBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode InputNotifyPeerBox to nil" )
}
v , err := DecodeInputNotifyPeer (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .InputNotifyPeer = v
return nil
}
func (b *InputNotifyPeerBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .InputNotifyPeer == nil {
return fmt .Errorf ("unable to encode InputNotifyPeerClass as nil" )
}
return b .InputNotifyPeer .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 .