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 MessagesReactionsNotModified struct {
}
const MessagesReactionsNotModifiedTypeID = 0xb06fdbdf
func (r MessagesReactionsNotModified ) construct () MessagesReactionsClass { return &r }
var (
_ bin .Encoder = &MessagesReactionsNotModified {}
_ bin .Decoder = &MessagesReactionsNotModified {}
_ bin .BareEncoder = &MessagesReactionsNotModified {}
_ bin .BareDecoder = &MessagesReactionsNotModified {}
_ MessagesReactionsClass = &MessagesReactionsNotModified {}
)
func (r *MessagesReactionsNotModified ) Zero () bool {
if r == nil {
return true
}
return true
}
func (r *MessagesReactionsNotModified ) String () string {
if r == nil {
return "MessagesReactionsNotModified(nil)"
}
type Alias MessagesReactionsNotModified
return fmt .Sprintf ("MessagesReactionsNotModified%+v" , Alias (*r ))
}
func (*MessagesReactionsNotModified ) TypeID () uint32 {
return MessagesReactionsNotModifiedTypeID
}
func (*MessagesReactionsNotModified ) TypeName () string {
return "messages.reactionsNotModified"
}
func (r *MessagesReactionsNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.reactionsNotModified" ,
ID : MessagesReactionsNotModifiedTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (r *MessagesReactionsNotModified ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reactionsNotModified#b06fdbdf as nil" )
}
b .PutID (MessagesReactionsNotModifiedTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReactionsNotModified ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reactionsNotModified#b06fdbdf as nil" )
}
return nil
}
func (r *MessagesReactionsNotModified ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reactionsNotModified#b06fdbdf to nil" )
}
if err := b .ConsumeID (MessagesReactionsNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.reactionsNotModified#b06fdbdf: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReactionsNotModified ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reactionsNotModified#b06fdbdf to nil" )
}
return nil
}
type MessagesReactions struct {
Hash int64
Reactions []ReactionClass
}
const MessagesReactionsTypeID = 0xeafdf716
func (r MessagesReactions ) construct () MessagesReactionsClass { return &r }
var (
_ bin .Encoder = &MessagesReactions {}
_ bin .Decoder = &MessagesReactions {}
_ bin .BareEncoder = &MessagesReactions {}
_ bin .BareDecoder = &MessagesReactions {}
_ MessagesReactionsClass = &MessagesReactions {}
)
func (r *MessagesReactions ) Zero () bool {
if r == nil {
return true
}
if !(r .Hash == 0 ) {
return false
}
if !(r .Reactions == nil ) {
return false
}
return true
}
func (r *MessagesReactions ) String () string {
if r == nil {
return "MessagesReactions(nil)"
}
type Alias MessagesReactions
return fmt .Sprintf ("MessagesReactions%+v" , Alias (*r ))
}
func (r *MessagesReactions ) FillFrom (from interface {
GetHash () (value int64 )
GetReactions () (value []ReactionClass )
}) {
r .Hash = from .GetHash ()
r .Reactions = from .GetReactions ()
}
func (*MessagesReactions ) TypeID () uint32 {
return MessagesReactionsTypeID
}
func (*MessagesReactions ) TypeName () string {
return "messages.reactions"
}
func (r *MessagesReactions ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.reactions" ,
ID : MessagesReactionsTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Reactions" ,
SchemaName : "reactions" ,
},
}
return typ
}
func (r *MessagesReactions ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reactions#eafdf716 as nil" )
}
b .PutID (MessagesReactionsTypeID )
return r .EncodeBare (b )
}
func (r *MessagesReactions ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode messages.reactions#eafdf716 as nil" )
}
b .PutLong (r .Hash )
b .PutVectorHeader (len (r .Reactions ))
for idx , v := range r .Reactions {
if v == nil {
return fmt .Errorf ("unable to encode messages.reactions#eafdf716: field reactions element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.reactions#eafdf716: field reactions element with index %d: %w" , idx , err )
}
}
return nil
}
func (r *MessagesReactions ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reactions#eafdf716 to nil" )
}
if err := b .ConsumeID (MessagesReactionsTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.reactions#eafdf716: %w" , err )
}
return r .DecodeBare (b )
}
func (r *MessagesReactions ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode messages.reactions#eafdf716 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.reactions#eafdf716: field hash: %w" , err )
}
r .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.reactions#eafdf716: field reactions: %w" , err )
}
if headerLen > 0 {
r .Reactions = make ([]ReactionClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeReaction (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.reactions#eafdf716: field reactions: %w" , err )
}
r .Reactions = append (r .Reactions , value )
}
}
return nil
}
func (r *MessagesReactions ) GetHash () (value int64 ) {
if r == nil {
return
}
return r .Hash
}
func (r *MessagesReactions ) GetReactions () (value []ReactionClass ) {
if r == nil {
return
}
return r .Reactions
}
func (r *MessagesReactions ) MapReactions () (value ReactionClassArray ) {
return ReactionClassArray (r .Reactions )
}
const MessagesReactionsClassName = "messages.Reactions"
type MessagesReactionsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesReactionsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesReactions , bool )
}
func (r *MessagesReactionsNotModified ) AsModified () (*MessagesReactions , bool ) {
return nil , false
}
func (r *MessagesReactions ) AsModified () (*MessagesReactions , bool ) {
return r , true
}
func DecodeMessagesReactions (buf *bin .Buffer ) (MessagesReactionsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesReactionsNotModifiedTypeID :
v := MessagesReactionsNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesReactionsClass: %w" , err )
}
return &v , nil
case MessagesReactionsTypeID :
v := MessagesReactions {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesReactionsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesReactionsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesReactionsBox struct {
Reactions MessagesReactionsClass
}
func (b *MessagesReactionsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesReactionsBox to nil" )
}
v , err := DecodeMessagesReactions (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .Reactions = v
return nil
}
func (b *MessagesReactionsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .Reactions == nil {
return fmt .Errorf ("unable to encode MessagesReactionsClass as nil" )
}
return b .Reactions .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 .