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 AccountEmojiStatusesNotModified struct {
}
const AccountEmojiStatusesNotModifiedTypeID = 0xd08ce645
func (e AccountEmojiStatusesNotModified ) construct () AccountEmojiStatusesClass { return &e }
var (
_ bin .Encoder = &AccountEmojiStatusesNotModified {}
_ bin .Decoder = &AccountEmojiStatusesNotModified {}
_ bin .BareEncoder = &AccountEmojiStatusesNotModified {}
_ bin .BareDecoder = &AccountEmojiStatusesNotModified {}
_ AccountEmojiStatusesClass = &AccountEmojiStatusesNotModified {}
)
func (e *AccountEmojiStatusesNotModified ) Zero () bool {
if e == nil {
return true
}
return true
}
func (e *AccountEmojiStatusesNotModified ) String () string {
if e == nil {
return "AccountEmojiStatusesNotModified(nil)"
}
type Alias AccountEmojiStatusesNotModified
return fmt .Sprintf ("AccountEmojiStatusesNotModified%+v" , Alias (*e ))
}
func (*AccountEmojiStatusesNotModified ) TypeID () uint32 {
return AccountEmojiStatusesNotModifiedTypeID
}
func (*AccountEmojiStatusesNotModified ) TypeName () string {
return "account.emojiStatusesNotModified"
}
func (e *AccountEmojiStatusesNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.emojiStatusesNotModified" ,
ID : AccountEmojiStatusesNotModifiedTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (e *AccountEmojiStatusesNotModified ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emojiStatusesNotModified#d08ce645 as nil" )
}
b .PutID (AccountEmojiStatusesNotModifiedTypeID )
return e .EncodeBare (b )
}
func (e *AccountEmojiStatusesNotModified ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emojiStatusesNotModified#d08ce645 as nil" )
}
return nil
}
func (e *AccountEmojiStatusesNotModified ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emojiStatusesNotModified#d08ce645 to nil" )
}
if err := b .ConsumeID (AccountEmojiStatusesNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.emojiStatusesNotModified#d08ce645: %w" , err )
}
return e .DecodeBare (b )
}
func (e *AccountEmojiStatusesNotModified ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emojiStatusesNotModified#d08ce645 to nil" )
}
return nil
}
type AccountEmojiStatuses struct {
Hash int64
Statuses []EmojiStatusClass
}
const AccountEmojiStatusesTypeID = 0x90c467d1
func (e AccountEmojiStatuses ) construct () AccountEmojiStatusesClass { return &e }
var (
_ bin .Encoder = &AccountEmojiStatuses {}
_ bin .Decoder = &AccountEmojiStatuses {}
_ bin .BareEncoder = &AccountEmojiStatuses {}
_ bin .BareDecoder = &AccountEmojiStatuses {}
_ AccountEmojiStatusesClass = &AccountEmojiStatuses {}
)
func (e *AccountEmojiStatuses ) Zero () bool {
if e == nil {
return true
}
if !(e .Hash == 0 ) {
return false
}
if !(e .Statuses == nil ) {
return false
}
return true
}
func (e *AccountEmojiStatuses ) String () string {
if e == nil {
return "AccountEmojiStatuses(nil)"
}
type Alias AccountEmojiStatuses
return fmt .Sprintf ("AccountEmojiStatuses%+v" , Alias (*e ))
}
func (e *AccountEmojiStatuses ) FillFrom (from interface {
GetHash () (value int64 )
GetStatuses () (value []EmojiStatusClass )
}) {
e .Hash = from .GetHash ()
e .Statuses = from .GetStatuses ()
}
func (*AccountEmojiStatuses ) TypeID () uint32 {
return AccountEmojiStatusesTypeID
}
func (*AccountEmojiStatuses ) TypeName () string {
return "account.emojiStatuses"
}
func (e *AccountEmojiStatuses ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.emojiStatuses" ,
ID : AccountEmojiStatusesTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Statuses" ,
SchemaName : "statuses" ,
},
}
return typ
}
func (e *AccountEmojiStatuses ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emojiStatuses#90c467d1 as nil" )
}
b .PutID (AccountEmojiStatusesTypeID )
return e .EncodeBare (b )
}
func (e *AccountEmojiStatuses ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode account.emojiStatuses#90c467d1 as nil" )
}
b .PutLong (e .Hash )
b .PutVectorHeader (len (e .Statuses ))
for idx , v := range e .Statuses {
if v == nil {
return fmt .Errorf ("unable to encode account.emojiStatuses#90c467d1: field statuses element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.emojiStatuses#90c467d1: field statuses element with index %d: %w" , idx , err )
}
}
return nil
}
func (e *AccountEmojiStatuses ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emojiStatuses#90c467d1 to nil" )
}
if err := b .ConsumeID (AccountEmojiStatusesTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.emojiStatuses#90c467d1: %w" , err )
}
return e .DecodeBare (b )
}
func (e *AccountEmojiStatuses ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode account.emojiStatuses#90c467d1 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode account.emojiStatuses#90c467d1: field hash: %w" , err )
}
e .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode account.emojiStatuses#90c467d1: field statuses: %w" , err )
}
if headerLen > 0 {
e .Statuses = make ([]EmojiStatusClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeEmojiStatus (b )
if err != nil {
return fmt .Errorf ("unable to decode account.emojiStatuses#90c467d1: field statuses: %w" , err )
}
e .Statuses = append (e .Statuses , value )
}
}
return nil
}
func (e *AccountEmojiStatuses ) GetHash () (value int64 ) {
if e == nil {
return
}
return e .Hash
}
func (e *AccountEmojiStatuses ) GetStatuses () (value []EmojiStatusClass ) {
if e == nil {
return
}
return e .Statuses
}
func (e *AccountEmojiStatuses ) MapStatuses () (value EmojiStatusClassArray ) {
return EmojiStatusClassArray (e .Statuses )
}
const AccountEmojiStatusesClassName = "account.EmojiStatuses"
type AccountEmojiStatusesClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () AccountEmojiStatusesClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*AccountEmojiStatuses , bool )
}
func (e *AccountEmojiStatusesNotModified ) AsModified () (*AccountEmojiStatuses , bool ) {
return nil , false
}
func (e *AccountEmojiStatuses ) AsModified () (*AccountEmojiStatuses , bool ) {
return e , true
}
func DecodeAccountEmojiStatuses (buf *bin .Buffer ) (AccountEmojiStatusesClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case AccountEmojiStatusesNotModifiedTypeID :
v := AccountEmojiStatusesNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountEmojiStatusesClass: %w" , err )
}
return &v , nil
case AccountEmojiStatusesTypeID :
v := AccountEmojiStatuses {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountEmojiStatusesClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode AccountEmojiStatusesClass: %w" , bin .NewUnexpectedID (id ))
}
}
type AccountEmojiStatusesBox struct {
EmojiStatuses AccountEmojiStatusesClass
}
func (b *AccountEmojiStatusesBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode AccountEmojiStatusesBox to nil" )
}
v , err := DecodeAccountEmojiStatuses (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .EmojiStatuses = v
return nil
}
func (b *AccountEmojiStatusesBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .EmojiStatuses == nil {
return fmt .Errorf ("unable to encode AccountEmojiStatusesClass as nil" )
}
return b .EmojiStatuses .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 .