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 MessagesSavedGifsNotModified struct {
}
const MessagesSavedGifsNotModifiedTypeID = 0xe8025ca2
func (s MessagesSavedGifsNotModified ) construct () MessagesSavedGifsClass { return &s }
var (
_ bin .Encoder = &MessagesSavedGifsNotModified {}
_ bin .Decoder = &MessagesSavedGifsNotModified {}
_ bin .BareEncoder = &MessagesSavedGifsNotModified {}
_ bin .BareDecoder = &MessagesSavedGifsNotModified {}
_ MessagesSavedGifsClass = &MessagesSavedGifsNotModified {}
)
func (s *MessagesSavedGifsNotModified ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *MessagesSavedGifsNotModified ) String () string {
if s == nil {
return "MessagesSavedGifsNotModified(nil)"
}
type Alias MessagesSavedGifsNotModified
return fmt .Sprintf ("MessagesSavedGifsNotModified%+v" , Alias (*s ))
}
func (*MessagesSavedGifsNotModified ) TypeID () uint32 {
return MessagesSavedGifsNotModifiedTypeID
}
func (*MessagesSavedGifsNotModified ) TypeName () string {
return "messages.savedGifsNotModified"
}
func (s *MessagesSavedGifsNotModified ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.savedGifsNotModified" ,
ID : MessagesSavedGifsNotModifiedTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *MessagesSavedGifsNotModified ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.savedGifsNotModified#e8025ca2 as nil" )
}
b .PutID (MessagesSavedGifsNotModifiedTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSavedGifsNotModified ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.savedGifsNotModified#e8025ca2 as nil" )
}
return nil
}
func (s *MessagesSavedGifsNotModified ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.savedGifsNotModified#e8025ca2 to nil" )
}
if err := b .ConsumeID (MessagesSavedGifsNotModifiedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.savedGifsNotModified#e8025ca2: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSavedGifsNotModified ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.savedGifsNotModified#e8025ca2 to nil" )
}
return nil
}
type MessagesSavedGifs struct {
Hash int64
Gifs []DocumentClass
}
const MessagesSavedGifsTypeID = 0x84a02a0d
func (s MessagesSavedGifs ) construct () MessagesSavedGifsClass { return &s }
var (
_ bin .Encoder = &MessagesSavedGifs {}
_ bin .Decoder = &MessagesSavedGifs {}
_ bin .BareEncoder = &MessagesSavedGifs {}
_ bin .BareDecoder = &MessagesSavedGifs {}
_ MessagesSavedGifsClass = &MessagesSavedGifs {}
)
func (s *MessagesSavedGifs ) Zero () bool {
if s == nil {
return true
}
if !(s .Hash == 0 ) {
return false
}
if !(s .Gifs == nil ) {
return false
}
return true
}
func (s *MessagesSavedGifs ) String () string {
if s == nil {
return "MessagesSavedGifs(nil)"
}
type Alias MessagesSavedGifs
return fmt .Sprintf ("MessagesSavedGifs%+v" , Alias (*s ))
}
func (s *MessagesSavedGifs ) FillFrom (from interface {
GetHash () (value int64 )
GetGifs () (value []DocumentClass )
}) {
s .Hash = from .GetHash ()
s .Gifs = from .GetGifs ()
}
func (*MessagesSavedGifs ) TypeID () uint32 {
return MessagesSavedGifsTypeID
}
func (*MessagesSavedGifs ) TypeName () string {
return "messages.savedGifs"
}
func (s *MessagesSavedGifs ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.savedGifs" ,
ID : MessagesSavedGifsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Hash" ,
SchemaName : "hash" ,
},
{
Name : "Gifs" ,
SchemaName : "gifs" ,
},
}
return typ
}
func (s *MessagesSavedGifs ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.savedGifs#84a02a0d as nil" )
}
b .PutID (MessagesSavedGifsTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSavedGifs ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.savedGifs#84a02a0d as nil" )
}
b .PutLong (s .Hash )
b .PutVectorHeader (len (s .Gifs ))
for idx , v := range s .Gifs {
if v == nil {
return fmt .Errorf ("unable to encode messages.savedGifs#84a02a0d: field gifs element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.savedGifs#84a02a0d: field gifs element with index %d: %w" , idx , err )
}
}
return nil
}
func (s *MessagesSavedGifs ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.savedGifs#84a02a0d to nil" )
}
if err := b .ConsumeID (MessagesSavedGifsTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.savedGifs#84a02a0d: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSavedGifs ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.savedGifs#84a02a0d to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.savedGifs#84a02a0d: field hash: %w" , err )
}
s .Hash = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messages.savedGifs#84a02a0d: field gifs: %w" , err )
}
if headerLen > 0 {
s .Gifs = make ([]DocumentClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.savedGifs#84a02a0d: field gifs: %w" , err )
}
s .Gifs = append (s .Gifs , value )
}
}
return nil
}
func (s *MessagesSavedGifs ) GetHash () (value int64 ) {
if s == nil {
return
}
return s .Hash
}
func (s *MessagesSavedGifs ) GetGifs () (value []DocumentClass ) {
if s == nil {
return
}
return s .Gifs
}
func (s *MessagesSavedGifs ) MapGifs () (value DocumentClassArray ) {
return DocumentClassArray (s .Gifs )
}
const MessagesSavedGifsClassName = "messages.SavedGifs"
type MessagesSavedGifsClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessagesSavedGifsClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
AsModified () (*MessagesSavedGifs , bool )
}
func (s *MessagesSavedGifsNotModified ) AsModified () (*MessagesSavedGifs , bool ) {
return nil , false
}
func (s *MessagesSavedGifs ) AsModified () (*MessagesSavedGifs , bool ) {
return s , true
}
func DecodeMessagesSavedGifs (buf *bin .Buffer ) (MessagesSavedGifsClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessagesSavedGifsNotModifiedTypeID :
v := MessagesSavedGifsNotModified {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesSavedGifsClass: %w" , err )
}
return &v , nil
case MessagesSavedGifsTypeID :
v := MessagesSavedGifs {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessagesSavedGifsClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessagesSavedGifsClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessagesSavedGifsBox struct {
SavedGifs MessagesSavedGifsClass
}
func (b *MessagesSavedGifsBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessagesSavedGifsBox to nil" )
}
v , err := DecodeMessagesSavedGifs (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .SavedGifs = v
return nil
}
func (b *MessagesSavedGifsBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .SavedGifs == nil {
return fmt .Errorf ("unable to encode MessagesSavedGifsClass as nil" )
}
return b .SavedGifs .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 .