// Code generated by gotdgen, DO NOT EDIT. package tg import ( "context" "errors" "fmt" "sort" "strings" "go.uber.org/multierr" "go.mau.fi/mautrix-telegram/pkg/gotd/bin" "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" "go.mau.fi/mautrix-telegram/pkg/gotd/tgerr" ) // No-op definition for keeping imports. var ( _ = bin.Buffer{} _ = context.Background() _ = fmt.Stringer(nil) _ = strings.Builder{} _ = errors.Is _ = multierr.AppendInto _ = sort.Ints _ = tdp.Format _ = tgerr.Error{} _ = tdjson.Encoder{} ) // ProfileTabPosts represents TL type `profileTabPosts#b98cd696`. // Represents the stories¹ tab of a profile page. // // Links: // 1. https://core.telegram.org/api/stories // // See https://core.telegram.org/constructor/profileTabPosts for reference. type ProfileTabPosts struct { } // ProfileTabPostsTypeID is TL type id of ProfileTabPosts. const ProfileTabPostsTypeID = 0xb98cd696 // construct implements constructor of ProfileTabClass. func (p ProfileTabPosts) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabPosts. var ( _ bin.Encoder = &ProfileTabPosts{} _ bin.Decoder = &ProfileTabPosts{} _ bin.BareEncoder = &ProfileTabPosts{} _ bin.BareDecoder = &ProfileTabPosts{} _ ProfileTabClass = &ProfileTabPosts{} ) func (p *ProfileTabPosts) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabPosts) String() string { if p == nil { return "ProfileTabPosts(nil)" } type Alias ProfileTabPosts return fmt.Sprintf("ProfileTabPosts%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabPosts) TypeID() uint32 { return ProfileTabPostsTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabPosts) TypeName() string { return "profileTabPosts" } // TypeInfo returns info about TL type. func (p *ProfileTabPosts) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabPosts", ID: ProfileTabPostsTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabPosts) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabPosts#b98cd696 as nil") } b.PutID(ProfileTabPostsTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabPosts) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabPosts#b98cd696 as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabPosts) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabPosts#b98cd696 to nil") } if err := b.ConsumeID(ProfileTabPostsTypeID); err != nil { return fmt.Errorf("unable to decode profileTabPosts#b98cd696: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabPosts) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabPosts#b98cd696 to nil") } return nil } // ProfileTabGifts represents TL type `profileTabGifts#4d4bd46a`. // Represents the gifts¹ tab of a profile page. // // Links: // 1. https://core.telegram.org/api/gifts // // See https://core.telegram.org/constructor/profileTabGifts for reference. type ProfileTabGifts struct { } // ProfileTabGiftsTypeID is TL type id of ProfileTabGifts. const ProfileTabGiftsTypeID = 0x4d4bd46a // construct implements constructor of ProfileTabClass. func (p ProfileTabGifts) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabGifts. var ( _ bin.Encoder = &ProfileTabGifts{} _ bin.Decoder = &ProfileTabGifts{} _ bin.BareEncoder = &ProfileTabGifts{} _ bin.BareDecoder = &ProfileTabGifts{} _ ProfileTabClass = &ProfileTabGifts{} ) func (p *ProfileTabGifts) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabGifts) String() string { if p == nil { return "ProfileTabGifts(nil)" } type Alias ProfileTabGifts return fmt.Sprintf("ProfileTabGifts%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabGifts) TypeID() uint32 { return ProfileTabGiftsTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabGifts) TypeName() string { return "profileTabGifts" } // TypeInfo returns info about TL type. func (p *ProfileTabGifts) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabGifts", ID: ProfileTabGiftsTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabGifts) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabGifts#4d4bd46a as nil") } b.PutID(ProfileTabGiftsTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabGifts) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabGifts#4d4bd46a as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabGifts) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabGifts#4d4bd46a to nil") } if err := b.ConsumeID(ProfileTabGiftsTypeID); err != nil { return fmt.Errorf("unable to decode profileTabGifts#4d4bd46a: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabGifts) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabGifts#4d4bd46a to nil") } return nil } // ProfileTabMedia represents TL type `profileTabMedia#72c64955`. // Represents the media tab of a profile page. // // See https://core.telegram.org/constructor/profileTabMedia for reference. type ProfileTabMedia struct { } // ProfileTabMediaTypeID is TL type id of ProfileTabMedia. const ProfileTabMediaTypeID = 0x72c64955 // construct implements constructor of ProfileTabClass. func (p ProfileTabMedia) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabMedia. var ( _ bin.Encoder = &ProfileTabMedia{} _ bin.Decoder = &ProfileTabMedia{} _ bin.BareEncoder = &ProfileTabMedia{} _ bin.BareDecoder = &ProfileTabMedia{} _ ProfileTabClass = &ProfileTabMedia{} ) func (p *ProfileTabMedia) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabMedia) String() string { if p == nil { return "ProfileTabMedia(nil)" } type Alias ProfileTabMedia return fmt.Sprintf("ProfileTabMedia%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabMedia) TypeID() uint32 { return ProfileTabMediaTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabMedia) TypeName() string { return "profileTabMedia" } // TypeInfo returns info about TL type. func (p *ProfileTabMedia) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabMedia", ID: ProfileTabMediaTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabMedia) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabMedia#72c64955 as nil") } b.PutID(ProfileTabMediaTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabMedia) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabMedia#72c64955 as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabMedia) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabMedia#72c64955 to nil") } if err := b.ConsumeID(ProfileTabMediaTypeID); err != nil { return fmt.Errorf("unable to decode profileTabMedia#72c64955: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabMedia) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabMedia#72c64955 to nil") } return nil } // ProfileTabFiles represents TL type `profileTabFiles#ab339c00`. // Represents the shared files tab of a profile. // // See https://core.telegram.org/constructor/profileTabFiles for reference. type ProfileTabFiles struct { } // ProfileTabFilesTypeID is TL type id of ProfileTabFiles. const ProfileTabFilesTypeID = 0xab339c00 // construct implements constructor of ProfileTabClass. func (p ProfileTabFiles) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabFiles. var ( _ bin.Encoder = &ProfileTabFiles{} _ bin.Decoder = &ProfileTabFiles{} _ bin.BareEncoder = &ProfileTabFiles{} _ bin.BareDecoder = &ProfileTabFiles{} _ ProfileTabClass = &ProfileTabFiles{} ) func (p *ProfileTabFiles) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabFiles) String() string { if p == nil { return "ProfileTabFiles(nil)" } type Alias ProfileTabFiles return fmt.Sprintf("ProfileTabFiles%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabFiles) TypeID() uint32 { return ProfileTabFilesTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabFiles) TypeName() string { return "profileTabFiles" } // TypeInfo returns info about TL type. func (p *ProfileTabFiles) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabFiles", ID: ProfileTabFilesTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabFiles) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabFiles#ab339c00 as nil") } b.PutID(ProfileTabFilesTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabFiles) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabFiles#ab339c00 as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabFiles) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabFiles#ab339c00 to nil") } if err := b.ConsumeID(ProfileTabFilesTypeID); err != nil { return fmt.Errorf("unable to decode profileTabFiles#ab339c00: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabFiles) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabFiles#ab339c00 to nil") } return nil } // ProfileTabMusic represents TL type `profileTabMusic#9f27d26e`. // Represents the music¹ tab of a profile page. // // Links: // 1. https://core.telegram.org/api/profile#music // // See https://core.telegram.org/constructor/profileTabMusic for reference. type ProfileTabMusic struct { } // ProfileTabMusicTypeID is TL type id of ProfileTabMusic. const ProfileTabMusicTypeID = 0x9f27d26e // construct implements constructor of ProfileTabClass. func (p ProfileTabMusic) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabMusic. var ( _ bin.Encoder = &ProfileTabMusic{} _ bin.Decoder = &ProfileTabMusic{} _ bin.BareEncoder = &ProfileTabMusic{} _ bin.BareDecoder = &ProfileTabMusic{} _ ProfileTabClass = &ProfileTabMusic{} ) func (p *ProfileTabMusic) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabMusic) String() string { if p == nil { return "ProfileTabMusic(nil)" } type Alias ProfileTabMusic return fmt.Sprintf("ProfileTabMusic%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabMusic) TypeID() uint32 { return ProfileTabMusicTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabMusic) TypeName() string { return "profileTabMusic" } // TypeInfo returns info about TL type. func (p *ProfileTabMusic) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabMusic", ID: ProfileTabMusicTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabMusic) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabMusic#9f27d26e as nil") } b.PutID(ProfileTabMusicTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabMusic) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabMusic#9f27d26e as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabMusic) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabMusic#9f27d26e to nil") } if err := b.ConsumeID(ProfileTabMusicTypeID); err != nil { return fmt.Errorf("unable to decode profileTabMusic#9f27d26e: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabMusic) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabMusic#9f27d26e to nil") } return nil } // ProfileTabVoice represents TL type `profileTabVoice#e477092e`. // Represents the voice messages tab of a profile page. // // See https://core.telegram.org/constructor/profileTabVoice for reference. type ProfileTabVoice struct { } // ProfileTabVoiceTypeID is TL type id of ProfileTabVoice. const ProfileTabVoiceTypeID = 0xe477092e // construct implements constructor of ProfileTabClass. func (p ProfileTabVoice) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabVoice. var ( _ bin.Encoder = &ProfileTabVoice{} _ bin.Decoder = &ProfileTabVoice{} _ bin.BareEncoder = &ProfileTabVoice{} _ bin.BareDecoder = &ProfileTabVoice{} _ ProfileTabClass = &ProfileTabVoice{} ) func (p *ProfileTabVoice) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabVoice) String() string { if p == nil { return "ProfileTabVoice(nil)" } type Alias ProfileTabVoice return fmt.Sprintf("ProfileTabVoice%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabVoice) TypeID() uint32 { return ProfileTabVoiceTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabVoice) TypeName() string { return "profileTabVoice" } // TypeInfo returns info about TL type. func (p *ProfileTabVoice) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabVoice", ID: ProfileTabVoiceTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabVoice) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabVoice#e477092e as nil") } b.PutID(ProfileTabVoiceTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabVoice) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabVoice#e477092e as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabVoice) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabVoice#e477092e to nil") } if err := b.ConsumeID(ProfileTabVoiceTypeID); err != nil { return fmt.Errorf("unable to decode profileTabVoice#e477092e: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabVoice) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabVoice#e477092e to nil") } return nil } // ProfileTabLinks represents TL type `profileTabLinks#d3656499`. // Represents the shared links tab of a profile page. // // See https://core.telegram.org/constructor/profileTabLinks for reference. type ProfileTabLinks struct { } // ProfileTabLinksTypeID is TL type id of ProfileTabLinks. const ProfileTabLinksTypeID = 0xd3656499 // construct implements constructor of ProfileTabClass. func (p ProfileTabLinks) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabLinks. var ( _ bin.Encoder = &ProfileTabLinks{} _ bin.Decoder = &ProfileTabLinks{} _ bin.BareEncoder = &ProfileTabLinks{} _ bin.BareDecoder = &ProfileTabLinks{} _ ProfileTabClass = &ProfileTabLinks{} ) func (p *ProfileTabLinks) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabLinks) String() string { if p == nil { return "ProfileTabLinks(nil)" } type Alias ProfileTabLinks return fmt.Sprintf("ProfileTabLinks%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabLinks) TypeID() uint32 { return ProfileTabLinksTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabLinks) TypeName() string { return "profileTabLinks" } // TypeInfo returns info about TL type. func (p *ProfileTabLinks) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabLinks", ID: ProfileTabLinksTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabLinks) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabLinks#d3656499 as nil") } b.PutID(ProfileTabLinksTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabLinks) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabLinks#d3656499 as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabLinks) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabLinks#d3656499 to nil") } if err := b.ConsumeID(ProfileTabLinksTypeID); err != nil { return fmt.Errorf("unable to decode profileTabLinks#d3656499: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabLinks) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabLinks#d3656499 to nil") } return nil } // ProfileTabGifs represents TL type `profileTabGifs#a2c0f695`. // Represents the gifs tab of a profile page. // // See https://core.telegram.org/constructor/profileTabGifs for reference. type ProfileTabGifs struct { } // ProfileTabGifsTypeID is TL type id of ProfileTabGifs. const ProfileTabGifsTypeID = 0xa2c0f695 // construct implements constructor of ProfileTabClass. func (p ProfileTabGifs) construct() ProfileTabClass { return &p } // Ensuring interfaces in compile-time for ProfileTabGifs. var ( _ bin.Encoder = &ProfileTabGifs{} _ bin.Decoder = &ProfileTabGifs{} _ bin.BareEncoder = &ProfileTabGifs{} _ bin.BareDecoder = &ProfileTabGifs{} _ ProfileTabClass = &ProfileTabGifs{} ) func (p *ProfileTabGifs) Zero() bool { if p == nil { return true } return true } // String implements fmt.Stringer. func (p *ProfileTabGifs) String() string { if p == nil { return "ProfileTabGifs(nil)" } type Alias ProfileTabGifs return fmt.Sprintf("ProfileTabGifs%+v", Alias(*p)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ProfileTabGifs) TypeID() uint32 { return ProfileTabGifsTypeID } // TypeName returns name of type in TL schema. func (*ProfileTabGifs) TypeName() string { return "profileTabGifs" } // TypeInfo returns info about TL type. func (p *ProfileTabGifs) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "profileTabGifs", ID: ProfileTabGifsTypeID, } if p == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (p *ProfileTabGifs) Encode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabGifs#a2c0f695 as nil") } b.PutID(ProfileTabGifsTypeID) return p.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (p *ProfileTabGifs) EncodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't encode profileTabGifs#a2c0f695 as nil") } return nil } // Decode implements bin.Decoder. func (p *ProfileTabGifs) Decode(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabGifs#a2c0f695 to nil") } if err := b.ConsumeID(ProfileTabGifsTypeID); err != nil { return fmt.Errorf("unable to decode profileTabGifs#a2c0f695: %w", err) } return p.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (p *ProfileTabGifs) DecodeBare(b *bin.Buffer) error { if p == nil { return fmt.Errorf("can't decode profileTabGifs#a2c0f695 to nil") } return nil } // ProfileTabClassName is schema name of ProfileTabClass. const ProfileTabClassName = "ProfileTab" // ProfileTabClass represents ProfileTab generic type. // // See https://core.telegram.org/type/ProfileTab for reference. // // Example: // // g, err := tg.DecodeProfileTab(buf) // if err != nil { // panic(err) // } // switch v := g.(type) { // case *tg.ProfileTabPosts: // profileTabPosts#b98cd696 // case *tg.ProfileTabGifts: // profileTabGifts#4d4bd46a // case *tg.ProfileTabMedia: // profileTabMedia#72c64955 // case *tg.ProfileTabFiles: // profileTabFiles#ab339c00 // case *tg.ProfileTabMusic: // profileTabMusic#9f27d26e // case *tg.ProfileTabVoice: // profileTabVoice#e477092e // case *tg.ProfileTabLinks: // profileTabLinks#d3656499 // case *tg.ProfileTabGifs: // profileTabGifs#a2c0f695 // default: panic(v) // } type ProfileTabClass interface { bin.Encoder bin.Decoder bin.BareEncoder bin.BareDecoder construct() ProfileTabClass // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. TypeID() uint32 // TypeName returns name of type in TL schema. TypeName() string // String implements fmt.Stringer. String() string // Zero returns true if current object has a zero value. Zero() bool } // DecodeProfileTab implements binary de-serialization for ProfileTabClass. func DecodeProfileTab(buf *bin.Buffer) (ProfileTabClass, error) { id, err := buf.PeekID() if err != nil { return nil, err } switch id { case ProfileTabPostsTypeID: // Decoding profileTabPosts#b98cd696. v := ProfileTabPosts{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabGiftsTypeID: // Decoding profileTabGifts#4d4bd46a. v := ProfileTabGifts{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabMediaTypeID: // Decoding profileTabMedia#72c64955. v := ProfileTabMedia{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabFilesTypeID: // Decoding profileTabFiles#ab339c00. v := ProfileTabFiles{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabMusicTypeID: // Decoding profileTabMusic#9f27d26e. v := ProfileTabMusic{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabVoiceTypeID: // Decoding profileTabVoice#e477092e. v := ProfileTabVoice{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabLinksTypeID: // Decoding profileTabLinks#d3656499. v := ProfileTabLinks{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil case ProfileTabGifsTypeID: // Decoding profileTabGifs#a2c0f695. v := ProfileTabGifs{} if err := v.Decode(buf); err != nil { return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", err) } return &v, nil default: return nil, fmt.Errorf("unable to decode ProfileTabClass: %w", bin.NewUnexpectedID(id)) } } // ProfileTab boxes the ProfileTabClass providing a helper. type ProfileTabBox struct { ProfileTab ProfileTabClass } // Decode implements bin.Decoder for ProfileTabBox. func (b *ProfileTabBox) Decode(buf *bin.Buffer) error { if b == nil { return fmt.Errorf("unable to decode ProfileTabBox to nil") } v, err := DecodeProfileTab(buf) if err != nil { return fmt.Errorf("unable to decode boxed value: %w", err) } b.ProfileTab = v return nil } // Encode implements bin.Encode for ProfileTabBox. func (b *ProfileTabBox) Encode(buf *bin.Buffer) error { if b == nil || b.ProfileTab == nil { return fmt.Errorf("unable to encode ProfileTabClass as nil") } return b.ProfileTab.Encode(buf) }