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 WebPageAttributeTheme struct {
Flags bin .Fields
Documents []DocumentClass
Settings ThemeSettings
}
const WebPageAttributeThemeTypeID = 0x54b56617
func (w WebPageAttributeTheme ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeTheme {}
_ bin .Decoder = &WebPageAttributeTheme {}
_ bin .BareEncoder = &WebPageAttributeTheme {}
_ bin .BareDecoder = &WebPageAttributeTheme {}
_ WebPageAttributeClass = &WebPageAttributeTheme {}
)
func (w *WebPageAttributeTheme ) Zero () bool {
if w == nil {
return true
}
if !(w .Flags .Zero ()) {
return false
}
if !(w .Documents == nil ) {
return false
}
if !(w .Settings .Zero ()) {
return false
}
return true
}
func (w *WebPageAttributeTheme ) String () string {
if w == nil {
return "WebPageAttributeTheme(nil)"
}
type Alias WebPageAttributeTheme
return fmt .Sprintf ("WebPageAttributeTheme%+v" , Alias (*w ))
}
func (w *WebPageAttributeTheme ) FillFrom (from interface {
GetDocuments () (value []DocumentClass , ok bool )
GetSettings () (value ThemeSettings , ok bool )
}) {
if val , ok := from .GetDocuments (); ok {
w .Documents = val
}
if val , ok := from .GetSettings (); ok {
w .Settings = val
}
}
func (*WebPageAttributeTheme ) TypeID () uint32 {
return WebPageAttributeThemeTypeID
}
func (*WebPageAttributeTheme ) TypeName () string {
return "webPageAttributeTheme"
}
func (w *WebPageAttributeTheme ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeTheme" ,
ID : WebPageAttributeThemeTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Documents" ,
SchemaName : "documents" ,
Null : !w .Flags .Has (0 ),
},
{
Name : "Settings" ,
SchemaName : "settings" ,
Null : !w .Flags .Has (1 ),
},
}
return typ
}
func (w *WebPageAttributeTheme ) SetFlags () {
if !(w .Documents == nil ) {
w .Flags .Set (0 )
}
if !(w .Settings .Zero ()) {
w .Flags .Set (1 )
}
}
func (w *WebPageAttributeTheme ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeTheme#54b56617 as nil" )
}
b .PutID (WebPageAttributeThemeTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeTheme ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeTheme#54b56617 as nil" )
}
w .SetFlags ()
if err := w .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeTheme#54b56617: field flags: %w" , err )
}
if w .Flags .Has (0 ) {
b .PutVectorHeader (len (w .Documents ))
for idx , v := range w .Documents {
if v == nil {
return fmt .Errorf ("unable to encode webPageAttributeTheme#54b56617: field documents element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeTheme#54b56617: field documents element with index %d: %w" , idx , err )
}
}
}
if w .Flags .Has (1 ) {
if err := w .Settings .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeTheme#54b56617: field settings: %w" , err )
}
}
return nil
}
func (w *WebPageAttributeTheme ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeTheme#54b56617 to nil" )
}
if err := b .ConsumeID (WebPageAttributeThemeTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeTheme#54b56617: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeTheme ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeTheme#54b56617 to nil" )
}
{
if err := w .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeTheme#54b56617: field flags: %w" , err )
}
}
if w .Flags .Has (0 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeTheme#54b56617: field documents: %w" , err )
}
if headerLen > 0 {
w .Documents = 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 webPageAttributeTheme#54b56617: field documents: %w" , err )
}
w .Documents = append (w .Documents , value )
}
}
if w .Flags .Has (1 ) {
if err := w .Settings .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeTheme#54b56617: field settings: %w" , err )
}
}
return nil
}
func (w *WebPageAttributeTheme ) SetDocuments (value []DocumentClass ) {
w .Flags .Set (0 )
w .Documents = value
}
func (w *WebPageAttributeTheme ) GetDocuments () (value []DocumentClass , ok bool ) {
if w == nil {
return
}
if !w .Flags .Has (0 ) {
return value , false
}
return w .Documents , true
}
func (w *WebPageAttributeTheme ) SetSettings (value ThemeSettings ) {
w .Flags .Set (1 )
w .Settings = value
}
func (w *WebPageAttributeTheme ) GetSettings () (value ThemeSettings , ok bool ) {
if w == nil {
return
}
if !w .Flags .Has (1 ) {
return value , false
}
return w .Settings , true
}
func (w *WebPageAttributeTheme ) MapDocuments () (value DocumentClassArray , ok bool ) {
if !w .Flags .Has (0 ) {
return value , false
}
return DocumentClassArray (w .Documents ), true
}
type WebPageAttributeStory struct {
Flags bin .Fields
Peer PeerClass
ID int
Story StoryItemClass
}
const WebPageAttributeStoryTypeID = 0x2e94c3e7
func (w WebPageAttributeStory ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeStory {}
_ bin .Decoder = &WebPageAttributeStory {}
_ bin .BareEncoder = &WebPageAttributeStory {}
_ bin .BareDecoder = &WebPageAttributeStory {}
_ WebPageAttributeClass = &WebPageAttributeStory {}
)
func (w *WebPageAttributeStory ) Zero () bool {
if w == nil {
return true
}
if !(w .Flags .Zero ()) {
return false
}
if !(w .Peer == nil ) {
return false
}
if !(w .ID == 0 ) {
return false
}
if !(w .Story == nil ) {
return false
}
return true
}
func (w *WebPageAttributeStory ) String () string {
if w == nil {
return "WebPageAttributeStory(nil)"
}
type Alias WebPageAttributeStory
return fmt .Sprintf ("WebPageAttributeStory%+v" , Alias (*w ))
}
func (w *WebPageAttributeStory ) FillFrom (from interface {
GetPeer () (value PeerClass )
GetID () (value int )
GetStory () (value StoryItemClass , ok bool )
}) {
w .Peer = from .GetPeer ()
w .ID = from .GetID ()
if val , ok := from .GetStory (); ok {
w .Story = val
}
}
func (*WebPageAttributeStory ) TypeID () uint32 {
return WebPageAttributeStoryTypeID
}
func (*WebPageAttributeStory ) TypeName () string {
return "webPageAttributeStory"
}
func (w *WebPageAttributeStory ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeStory" ,
ID : WebPageAttributeStoryTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Story" ,
SchemaName : "story" ,
Null : !w .Flags .Has (0 ),
},
}
return typ
}
func (w *WebPageAttributeStory ) SetFlags () {
if !(w .Story == nil ) {
w .Flags .Set (0 )
}
}
func (w *WebPageAttributeStory ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStory#2e94c3e7 as nil" )
}
b .PutID (WebPageAttributeStoryTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeStory ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStory#2e94c3e7 as nil" )
}
w .SetFlags ()
if err := w .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStory#2e94c3e7: field flags: %w" , err )
}
if w .Peer == nil {
return fmt .Errorf ("unable to encode webPageAttributeStory#2e94c3e7: field peer is nil" )
}
if err := w .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStory#2e94c3e7: field peer: %w" , err )
}
b .PutInt (w .ID )
if w .Flags .Has (0 ) {
if w .Story == nil {
return fmt .Errorf ("unable to encode webPageAttributeStory#2e94c3e7: field story is nil" )
}
if err := w .Story .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStory#2e94c3e7: field story: %w" , err )
}
}
return nil
}
func (w *WebPageAttributeStory ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStory#2e94c3e7 to nil" )
}
if err := b .ConsumeID (WebPageAttributeStoryTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStory#2e94c3e7: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeStory ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStory#2e94c3e7 to nil" )
}
{
if err := w .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStory#2e94c3e7: field flags: %w" , err )
}
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStory#2e94c3e7: field peer: %w" , err )
}
w .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStory#2e94c3e7: field id: %w" , err )
}
w .ID = value
}
if w .Flags .Has (0 ) {
value , err := DecodeStoryItem (b )
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStory#2e94c3e7: field story: %w" , err )
}
w .Story = value
}
return nil
}
func (w *WebPageAttributeStory ) GetPeer () (value PeerClass ) {
if w == nil {
return
}
return w .Peer
}
func (w *WebPageAttributeStory ) GetID () (value int ) {
if w == nil {
return
}
return w .ID
}
func (w *WebPageAttributeStory ) SetStory (value StoryItemClass ) {
w .Flags .Set (0 )
w .Story = value
}
func (w *WebPageAttributeStory ) GetStory () (value StoryItemClass , ok bool ) {
if w == nil {
return
}
if !w .Flags .Has (0 ) {
return value , false
}
return w .Story , true
}
type WebPageAttributeStickerSet struct {
Flags bin .Fields
Emojis bool
TextColor bool
Stickers []DocumentClass
}
const WebPageAttributeStickerSetTypeID = 0x50cc03d3
func (w WebPageAttributeStickerSet ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeStickerSet {}
_ bin .Decoder = &WebPageAttributeStickerSet {}
_ bin .BareEncoder = &WebPageAttributeStickerSet {}
_ bin .BareDecoder = &WebPageAttributeStickerSet {}
_ WebPageAttributeClass = &WebPageAttributeStickerSet {}
)
func (w *WebPageAttributeStickerSet ) Zero () bool {
if w == nil {
return true
}
if !(w .Flags .Zero ()) {
return false
}
if !(w .Emojis == false ) {
return false
}
if !(w .TextColor == false ) {
return false
}
if !(w .Stickers == nil ) {
return false
}
return true
}
func (w *WebPageAttributeStickerSet ) String () string {
if w == nil {
return "WebPageAttributeStickerSet(nil)"
}
type Alias WebPageAttributeStickerSet
return fmt .Sprintf ("WebPageAttributeStickerSet%+v" , Alias (*w ))
}
func (w *WebPageAttributeStickerSet ) FillFrom (from interface {
GetEmojis () (value bool )
GetTextColor () (value bool )
GetStickers () (value []DocumentClass )
}) {
w .Emojis = from .GetEmojis ()
w .TextColor = from .GetTextColor ()
w .Stickers = from .GetStickers ()
}
func (*WebPageAttributeStickerSet ) TypeID () uint32 {
return WebPageAttributeStickerSetTypeID
}
func (*WebPageAttributeStickerSet ) TypeName () string {
return "webPageAttributeStickerSet"
}
func (w *WebPageAttributeStickerSet ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeStickerSet" ,
ID : WebPageAttributeStickerSetTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Emojis" ,
SchemaName : "emojis" ,
Null : !w .Flags .Has (0 ),
},
{
Name : "TextColor" ,
SchemaName : "text_color" ,
Null : !w .Flags .Has (1 ),
},
{
Name : "Stickers" ,
SchemaName : "stickers" ,
},
}
return typ
}
func (w *WebPageAttributeStickerSet ) SetFlags () {
if !(w .Emojis == false ) {
w .Flags .Set (0 )
}
if !(w .TextColor == false ) {
w .Flags .Set (1 )
}
}
func (w *WebPageAttributeStickerSet ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStickerSet#50cc03d3 as nil" )
}
b .PutID (WebPageAttributeStickerSetTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeStickerSet ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStickerSet#50cc03d3 as nil" )
}
w .SetFlags ()
if err := w .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStickerSet#50cc03d3: field flags: %w" , err )
}
b .PutVectorHeader (len (w .Stickers ))
for idx , v := range w .Stickers {
if v == nil {
return fmt .Errorf ("unable to encode webPageAttributeStickerSet#50cc03d3: field stickers element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStickerSet#50cc03d3: field stickers element with index %d: %w" , idx , err )
}
}
return nil
}
func (w *WebPageAttributeStickerSet ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStickerSet#50cc03d3 to nil" )
}
if err := b .ConsumeID (WebPageAttributeStickerSetTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStickerSet#50cc03d3: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeStickerSet ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStickerSet#50cc03d3 to nil" )
}
{
if err := w .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStickerSet#50cc03d3: field flags: %w" , err )
}
}
w .Emojis = w .Flags .Has (0 )
w .TextColor = w .Flags .Has (1 )
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStickerSet#50cc03d3: field stickers: %w" , err )
}
if headerLen > 0 {
w .Stickers = 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 webPageAttributeStickerSet#50cc03d3: field stickers: %w" , err )
}
w .Stickers = append (w .Stickers , value )
}
}
return nil
}
func (w *WebPageAttributeStickerSet ) SetEmojis (value bool ) {
if value {
w .Flags .Set (0 )
w .Emojis = true
} else {
w .Flags .Unset (0 )
w .Emojis = false
}
}
func (w *WebPageAttributeStickerSet ) GetEmojis () (value bool ) {
if w == nil {
return
}
return w .Flags .Has (0 )
}
func (w *WebPageAttributeStickerSet ) SetTextColor (value bool ) {
if value {
w .Flags .Set (1 )
w .TextColor = true
} else {
w .Flags .Unset (1 )
w .TextColor = false
}
}
func (w *WebPageAttributeStickerSet ) GetTextColor () (value bool ) {
if w == nil {
return
}
return w .Flags .Has (1 )
}
func (w *WebPageAttributeStickerSet ) GetStickers () (value []DocumentClass ) {
if w == nil {
return
}
return w .Stickers
}
func (w *WebPageAttributeStickerSet ) MapStickers () (value DocumentClassArray ) {
return DocumentClassArray (w .Stickers )
}
type WebPageAttributeUniqueStarGift struct {
Gift StarGiftClass
}
const WebPageAttributeUniqueStarGiftTypeID = 0xcf6f6db8
func (w WebPageAttributeUniqueStarGift ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeUniqueStarGift {}
_ bin .Decoder = &WebPageAttributeUniqueStarGift {}
_ bin .BareEncoder = &WebPageAttributeUniqueStarGift {}
_ bin .BareDecoder = &WebPageAttributeUniqueStarGift {}
_ WebPageAttributeClass = &WebPageAttributeUniqueStarGift {}
)
func (w *WebPageAttributeUniqueStarGift ) Zero () bool {
if w == nil {
return true
}
if !(w .Gift == nil ) {
return false
}
return true
}
func (w *WebPageAttributeUniqueStarGift ) String () string {
if w == nil {
return "WebPageAttributeUniqueStarGift(nil)"
}
type Alias WebPageAttributeUniqueStarGift
return fmt .Sprintf ("WebPageAttributeUniqueStarGift%+v" , Alias (*w ))
}
func (w *WebPageAttributeUniqueStarGift ) FillFrom (from interface {
GetGift () (value StarGiftClass )
}) {
w .Gift = from .GetGift ()
}
func (*WebPageAttributeUniqueStarGift ) TypeID () uint32 {
return WebPageAttributeUniqueStarGiftTypeID
}
func (*WebPageAttributeUniqueStarGift ) TypeName () string {
return "webPageAttributeUniqueStarGift"
}
func (w *WebPageAttributeUniqueStarGift ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeUniqueStarGift" ,
ID : WebPageAttributeUniqueStarGiftTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Gift" ,
SchemaName : "gift" ,
},
}
return typ
}
func (w *WebPageAttributeUniqueStarGift ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeUniqueStarGift#cf6f6db8 as nil" )
}
b .PutID (WebPageAttributeUniqueStarGiftTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeUniqueStarGift ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeUniqueStarGift#cf6f6db8 as nil" )
}
if w .Gift == nil {
return fmt .Errorf ("unable to encode webPageAttributeUniqueStarGift#cf6f6db8: field gift is nil" )
}
if err := w .Gift .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeUniqueStarGift#cf6f6db8: field gift: %w" , err )
}
return nil
}
func (w *WebPageAttributeUniqueStarGift ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeUniqueStarGift#cf6f6db8 to nil" )
}
if err := b .ConsumeID (WebPageAttributeUniqueStarGiftTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeUniqueStarGift#cf6f6db8: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeUniqueStarGift ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeUniqueStarGift#cf6f6db8 to nil" )
}
{
value , err := DecodeStarGift (b )
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeUniqueStarGift#cf6f6db8: field gift: %w" , err )
}
w .Gift = value
}
return nil
}
func (w *WebPageAttributeUniqueStarGift ) GetGift () (value StarGiftClass ) {
if w == nil {
return
}
return w .Gift
}
type WebPageAttributeStarGiftCollection struct {
Icons []DocumentClass
}
const WebPageAttributeStarGiftCollectionTypeID = 0x31cad303
func (w WebPageAttributeStarGiftCollection ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeStarGiftCollection {}
_ bin .Decoder = &WebPageAttributeStarGiftCollection {}
_ bin .BareEncoder = &WebPageAttributeStarGiftCollection {}
_ bin .BareDecoder = &WebPageAttributeStarGiftCollection {}
_ WebPageAttributeClass = &WebPageAttributeStarGiftCollection {}
)
func (w *WebPageAttributeStarGiftCollection ) Zero () bool {
if w == nil {
return true
}
if !(w .Icons == nil ) {
return false
}
return true
}
func (w *WebPageAttributeStarGiftCollection ) String () string {
if w == nil {
return "WebPageAttributeStarGiftCollection(nil)"
}
type Alias WebPageAttributeStarGiftCollection
return fmt .Sprintf ("WebPageAttributeStarGiftCollection%+v" , Alias (*w ))
}
func (w *WebPageAttributeStarGiftCollection ) FillFrom (from interface {
GetIcons () (value []DocumentClass )
}) {
w .Icons = from .GetIcons ()
}
func (*WebPageAttributeStarGiftCollection ) TypeID () uint32 {
return WebPageAttributeStarGiftCollectionTypeID
}
func (*WebPageAttributeStarGiftCollection ) TypeName () string {
return "webPageAttributeStarGiftCollection"
}
func (w *WebPageAttributeStarGiftCollection ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeStarGiftCollection" ,
ID : WebPageAttributeStarGiftCollectionTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Icons" ,
SchemaName : "icons" ,
},
}
return typ
}
func (w *WebPageAttributeStarGiftCollection ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStarGiftCollection#31cad303 as nil" )
}
b .PutID (WebPageAttributeStarGiftCollectionTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeStarGiftCollection ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStarGiftCollection#31cad303 as nil" )
}
b .PutVectorHeader (len (w .Icons ))
for idx , v := range w .Icons {
if v == nil {
return fmt .Errorf ("unable to encode webPageAttributeStarGiftCollection#31cad303: field icons element with index %d is nil" , idx )
}
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStarGiftCollection#31cad303: field icons element with index %d: %w" , idx , err )
}
}
return nil
}
func (w *WebPageAttributeStarGiftCollection ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStarGiftCollection#31cad303 to nil" )
}
if err := b .ConsumeID (WebPageAttributeStarGiftCollectionTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStarGiftCollection#31cad303: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeStarGiftCollection ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStarGiftCollection#31cad303 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStarGiftCollection#31cad303: field icons: %w" , err )
}
if headerLen > 0 {
w .Icons = 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 webPageAttributeStarGiftCollection#31cad303: field icons: %w" , err )
}
w .Icons = append (w .Icons , value )
}
}
return nil
}
func (w *WebPageAttributeStarGiftCollection ) GetIcons () (value []DocumentClass ) {
if w == nil {
return
}
return w .Icons
}
func (w *WebPageAttributeStarGiftCollection ) MapIcons () (value DocumentClassArray ) {
return DocumentClassArray (w .Icons )
}
type WebPageAttributeStarGiftAuction struct {
Gift StarGiftClass
EndDate int
}
const WebPageAttributeStarGiftAuctionTypeID = 0x1c641c2
func (w WebPageAttributeStarGiftAuction ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeStarGiftAuction {}
_ bin .Decoder = &WebPageAttributeStarGiftAuction {}
_ bin .BareEncoder = &WebPageAttributeStarGiftAuction {}
_ bin .BareDecoder = &WebPageAttributeStarGiftAuction {}
_ WebPageAttributeClass = &WebPageAttributeStarGiftAuction {}
)
func (w *WebPageAttributeStarGiftAuction ) Zero () bool {
if w == nil {
return true
}
if !(w .Gift == nil ) {
return false
}
if !(w .EndDate == 0 ) {
return false
}
return true
}
func (w *WebPageAttributeStarGiftAuction ) String () string {
if w == nil {
return "WebPageAttributeStarGiftAuction(nil)"
}
type Alias WebPageAttributeStarGiftAuction
return fmt .Sprintf ("WebPageAttributeStarGiftAuction%+v" , Alias (*w ))
}
func (w *WebPageAttributeStarGiftAuction ) FillFrom (from interface {
GetGift () (value StarGiftClass )
GetEndDate () (value int )
}) {
w .Gift = from .GetGift ()
w .EndDate = from .GetEndDate ()
}
func (*WebPageAttributeStarGiftAuction ) TypeID () uint32 {
return WebPageAttributeStarGiftAuctionTypeID
}
func (*WebPageAttributeStarGiftAuction ) TypeName () string {
return "webPageAttributeStarGiftAuction"
}
func (w *WebPageAttributeStarGiftAuction ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeStarGiftAuction" ,
ID : WebPageAttributeStarGiftAuctionTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Gift" ,
SchemaName : "gift" ,
},
{
Name : "EndDate" ,
SchemaName : "end_date" ,
},
}
return typ
}
func (w *WebPageAttributeStarGiftAuction ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStarGiftAuction#1c641c2 as nil" )
}
b .PutID (WebPageAttributeStarGiftAuctionTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeStarGiftAuction ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeStarGiftAuction#1c641c2 as nil" )
}
if w .Gift == nil {
return fmt .Errorf ("unable to encode webPageAttributeStarGiftAuction#1c641c2: field gift is nil" )
}
if err := w .Gift .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode webPageAttributeStarGiftAuction#1c641c2: field gift: %w" , err )
}
b .PutInt (w .EndDate )
return nil
}
func (w *WebPageAttributeStarGiftAuction ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStarGiftAuction#1c641c2 to nil" )
}
if err := b .ConsumeID (WebPageAttributeStarGiftAuctionTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStarGiftAuction#1c641c2: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeStarGiftAuction ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeStarGiftAuction#1c641c2 to nil" )
}
{
value , err := DecodeStarGift (b )
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStarGiftAuction#1c641c2: field gift: %w" , err )
}
w .Gift = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeStarGiftAuction#1c641c2: field end_date: %w" , err )
}
w .EndDate = value
}
return nil
}
func (w *WebPageAttributeStarGiftAuction ) GetGift () (value StarGiftClass ) {
if w == nil {
return
}
return w .Gift
}
func (w *WebPageAttributeStarGiftAuction ) GetEndDate () (value int ) {
if w == nil {
return
}
return w .EndDate
}
type WebPageAttributeAiComposeTone struct {
EmojiID int64
}
const WebPageAttributeAiComposeToneTypeID = 0x7781fe18
func (w WebPageAttributeAiComposeTone ) construct () WebPageAttributeClass { return &w }
var (
_ bin .Encoder = &WebPageAttributeAiComposeTone {}
_ bin .Decoder = &WebPageAttributeAiComposeTone {}
_ bin .BareEncoder = &WebPageAttributeAiComposeTone {}
_ bin .BareDecoder = &WebPageAttributeAiComposeTone {}
_ WebPageAttributeClass = &WebPageAttributeAiComposeTone {}
)
func (w *WebPageAttributeAiComposeTone ) Zero () bool {
if w == nil {
return true
}
if !(w .EmojiID == 0 ) {
return false
}
return true
}
func (w *WebPageAttributeAiComposeTone ) String () string {
if w == nil {
return "WebPageAttributeAiComposeTone(nil)"
}
type Alias WebPageAttributeAiComposeTone
return fmt .Sprintf ("WebPageAttributeAiComposeTone%+v" , Alias (*w ))
}
func (w *WebPageAttributeAiComposeTone ) FillFrom (from interface {
GetEmojiID () (value int64 )
}) {
w .EmojiID = from .GetEmojiID ()
}
func (*WebPageAttributeAiComposeTone ) TypeID () uint32 {
return WebPageAttributeAiComposeToneTypeID
}
func (*WebPageAttributeAiComposeTone ) TypeName () string {
return "webPageAttributeAiComposeTone"
}
func (w *WebPageAttributeAiComposeTone ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "webPageAttributeAiComposeTone" ,
ID : WebPageAttributeAiComposeToneTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "EmojiID" ,
SchemaName : "emoji_id" ,
},
}
return typ
}
func (w *WebPageAttributeAiComposeTone ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeAiComposeTone#7781fe18 as nil" )
}
b .PutID (WebPageAttributeAiComposeToneTypeID )
return w .EncodeBare (b )
}
func (w *WebPageAttributeAiComposeTone ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode webPageAttributeAiComposeTone#7781fe18 as nil" )
}
b .PutLong (w .EmojiID )
return nil
}
func (w *WebPageAttributeAiComposeTone ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeAiComposeTone#7781fe18 to nil" )
}
if err := b .ConsumeID (WebPageAttributeAiComposeToneTypeID ); err != nil {
return fmt .Errorf ("unable to decode webPageAttributeAiComposeTone#7781fe18: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WebPageAttributeAiComposeTone ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode webPageAttributeAiComposeTone#7781fe18 to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode webPageAttributeAiComposeTone#7781fe18: field emoji_id: %w" , err )
}
w .EmojiID = value
}
return nil
}
func (w *WebPageAttributeAiComposeTone ) GetEmojiID () (value int64 ) {
if w == nil {
return
}
return w .EmojiID
}
const WebPageAttributeClassName = "WebPageAttribute"
type WebPageAttributeClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () WebPageAttributeClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeWebPageAttribute (buf *bin .Buffer ) (WebPageAttributeClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case WebPageAttributeThemeTypeID :
v := WebPageAttributeTheme {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
case WebPageAttributeStoryTypeID :
v := WebPageAttributeStory {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
case WebPageAttributeStickerSetTypeID :
v := WebPageAttributeStickerSet {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
case WebPageAttributeUniqueStarGiftTypeID :
v := WebPageAttributeUniqueStarGift {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
case WebPageAttributeStarGiftCollectionTypeID :
v := WebPageAttributeStarGiftCollection {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
case WebPageAttributeStarGiftAuctionTypeID :
v := WebPageAttributeStarGiftAuction {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
case WebPageAttributeAiComposeToneTypeID :
v := WebPageAttributeAiComposeTone {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode WebPageAttributeClass: %w" , bin .NewUnexpectedID (id ))
}
}
type WebPageAttributeBox struct {
WebPageAttribute WebPageAttributeClass
}
func (b *WebPageAttributeBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode WebPageAttributeBox to nil" )
}
v , err := DecodeWebPageAttribute (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .WebPageAttribute = v
return nil
}
func (b *WebPageAttributeBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .WebPageAttribute == nil {
return fmt .Errorf ("unable to encode WebPageAttributeClass as nil" )
}
return b .WebPageAttribute .Encode (buf )
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .