684 lines
20 KiB
Go
Generated
684 lines
20 KiB
Go
Generated
// 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{}
|
|
)
|
|
|
|
// StarGiftAttributeRarity represents TL type `starGiftAttributeRarity#36437737`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAttributeRarity for reference.
|
|
type StarGiftAttributeRarity struct {
|
|
// Permille field of StarGiftAttributeRarity.
|
|
Permille int
|
|
}
|
|
|
|
// StarGiftAttributeRarityTypeID is TL type id of StarGiftAttributeRarity.
|
|
const StarGiftAttributeRarityTypeID = 0x36437737
|
|
|
|
// construct implements constructor of StarGiftAttributeRarityClass.
|
|
func (s StarGiftAttributeRarity) construct() StarGiftAttributeRarityClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAttributeRarity.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAttributeRarity{}
|
|
_ bin.Decoder = &StarGiftAttributeRarity{}
|
|
_ bin.BareEncoder = &StarGiftAttributeRarity{}
|
|
_ bin.BareDecoder = &StarGiftAttributeRarity{}
|
|
|
|
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarity{}
|
|
)
|
|
|
|
func (s *StarGiftAttributeRarity) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
if !(s.Permille == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAttributeRarity) String() string {
|
|
if s == nil {
|
|
return "StarGiftAttributeRarity(nil)"
|
|
}
|
|
type Alias StarGiftAttributeRarity
|
|
return fmt.Sprintf("StarGiftAttributeRarity%+v", Alias(*s))
|
|
}
|
|
|
|
// FillFrom fills StarGiftAttributeRarity from given interface.
|
|
func (s *StarGiftAttributeRarity) FillFrom(from interface {
|
|
GetPermille() (value int)
|
|
}) {
|
|
s.Permille = from.GetPermille()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAttributeRarity) TypeID() uint32 {
|
|
return StarGiftAttributeRarityTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAttributeRarity) TypeName() string {
|
|
return "starGiftAttributeRarity"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAttributeRarity) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAttributeRarity",
|
|
ID: StarGiftAttributeRarityTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Permille",
|
|
SchemaName: "permille",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAttributeRarity) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarity#36437737 as nil")
|
|
}
|
|
b.PutID(StarGiftAttributeRarityTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAttributeRarity) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarity#36437737 as nil")
|
|
}
|
|
b.PutInt(s.Permille)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAttributeRarity) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarity#36437737 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAttributeRarityTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAttributeRarity#36437737: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAttributeRarity) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarity#36437737 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAttributeRarity#36437737: field permille: %w", err)
|
|
}
|
|
s.Permille = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPermille returns value of Permille field.
|
|
func (s *StarGiftAttributeRarity) GetPermille() (value int) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
return s.Permille
|
|
}
|
|
|
|
// StarGiftAttributeRarityUncommon represents TL type `starGiftAttributeRarityUncommon#dbce6389`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAttributeRarityUncommon for reference.
|
|
type StarGiftAttributeRarityUncommon struct {
|
|
}
|
|
|
|
// StarGiftAttributeRarityUncommonTypeID is TL type id of StarGiftAttributeRarityUncommon.
|
|
const StarGiftAttributeRarityUncommonTypeID = 0xdbce6389
|
|
|
|
// construct implements constructor of StarGiftAttributeRarityClass.
|
|
func (s StarGiftAttributeRarityUncommon) construct() StarGiftAttributeRarityClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAttributeRarityUncommon.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAttributeRarityUncommon{}
|
|
_ bin.Decoder = &StarGiftAttributeRarityUncommon{}
|
|
_ bin.BareEncoder = &StarGiftAttributeRarityUncommon{}
|
|
_ bin.BareDecoder = &StarGiftAttributeRarityUncommon{}
|
|
|
|
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityUncommon{}
|
|
)
|
|
|
|
func (s *StarGiftAttributeRarityUncommon) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAttributeRarityUncommon) String() string {
|
|
if s == nil {
|
|
return "StarGiftAttributeRarityUncommon(nil)"
|
|
}
|
|
type Alias StarGiftAttributeRarityUncommon
|
|
return fmt.Sprintf("StarGiftAttributeRarityUncommon%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAttributeRarityUncommon) TypeID() uint32 {
|
|
return StarGiftAttributeRarityUncommonTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAttributeRarityUncommon) TypeName() string {
|
|
return "starGiftAttributeRarityUncommon"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAttributeRarityUncommon) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAttributeRarityUncommon",
|
|
ID: StarGiftAttributeRarityUncommonTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAttributeRarityUncommon) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil")
|
|
}
|
|
b.PutID(StarGiftAttributeRarityUncommonTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAttributeRarityUncommon) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityUncommon#dbce6389 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAttributeRarityUncommon) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAttributeRarityUncommonTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAttributeRarityUncommon#dbce6389: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAttributeRarityUncommon) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityUncommon#dbce6389 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// StarGiftAttributeRarityRare represents TL type `starGiftAttributeRarityRare#f08d516b`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAttributeRarityRare for reference.
|
|
type StarGiftAttributeRarityRare struct {
|
|
}
|
|
|
|
// StarGiftAttributeRarityRareTypeID is TL type id of StarGiftAttributeRarityRare.
|
|
const StarGiftAttributeRarityRareTypeID = 0xf08d516b
|
|
|
|
// construct implements constructor of StarGiftAttributeRarityClass.
|
|
func (s StarGiftAttributeRarityRare) construct() StarGiftAttributeRarityClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAttributeRarityRare.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAttributeRarityRare{}
|
|
_ bin.Decoder = &StarGiftAttributeRarityRare{}
|
|
_ bin.BareEncoder = &StarGiftAttributeRarityRare{}
|
|
_ bin.BareDecoder = &StarGiftAttributeRarityRare{}
|
|
|
|
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityRare{}
|
|
)
|
|
|
|
func (s *StarGiftAttributeRarityRare) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAttributeRarityRare) String() string {
|
|
if s == nil {
|
|
return "StarGiftAttributeRarityRare(nil)"
|
|
}
|
|
type Alias StarGiftAttributeRarityRare
|
|
return fmt.Sprintf("StarGiftAttributeRarityRare%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAttributeRarityRare) TypeID() uint32 {
|
|
return StarGiftAttributeRarityRareTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAttributeRarityRare) TypeName() string {
|
|
return "starGiftAttributeRarityRare"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAttributeRarityRare) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAttributeRarityRare",
|
|
ID: StarGiftAttributeRarityRareTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAttributeRarityRare) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityRare#f08d516b as nil")
|
|
}
|
|
b.PutID(StarGiftAttributeRarityRareTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAttributeRarityRare) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityRare#f08d516b as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAttributeRarityRare) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityRare#f08d516b to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAttributeRarityRareTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAttributeRarityRare#f08d516b: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAttributeRarityRare) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityRare#f08d516b to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// StarGiftAttributeRarityEpic represents TL type `starGiftAttributeRarityEpic#78fbf3a8`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAttributeRarityEpic for reference.
|
|
type StarGiftAttributeRarityEpic struct {
|
|
}
|
|
|
|
// StarGiftAttributeRarityEpicTypeID is TL type id of StarGiftAttributeRarityEpic.
|
|
const StarGiftAttributeRarityEpicTypeID = 0x78fbf3a8
|
|
|
|
// construct implements constructor of StarGiftAttributeRarityClass.
|
|
func (s StarGiftAttributeRarityEpic) construct() StarGiftAttributeRarityClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAttributeRarityEpic.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAttributeRarityEpic{}
|
|
_ bin.Decoder = &StarGiftAttributeRarityEpic{}
|
|
_ bin.BareEncoder = &StarGiftAttributeRarityEpic{}
|
|
_ bin.BareDecoder = &StarGiftAttributeRarityEpic{}
|
|
|
|
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityEpic{}
|
|
)
|
|
|
|
func (s *StarGiftAttributeRarityEpic) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAttributeRarityEpic) String() string {
|
|
if s == nil {
|
|
return "StarGiftAttributeRarityEpic(nil)"
|
|
}
|
|
type Alias StarGiftAttributeRarityEpic
|
|
return fmt.Sprintf("StarGiftAttributeRarityEpic%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAttributeRarityEpic) TypeID() uint32 {
|
|
return StarGiftAttributeRarityEpicTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAttributeRarityEpic) TypeName() string {
|
|
return "starGiftAttributeRarityEpic"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAttributeRarityEpic) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAttributeRarityEpic",
|
|
ID: StarGiftAttributeRarityEpicTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAttributeRarityEpic) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil")
|
|
}
|
|
b.PutID(StarGiftAttributeRarityEpicTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAttributeRarityEpic) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityEpic#78fbf3a8 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAttributeRarityEpic) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAttributeRarityEpicTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAttributeRarityEpic#78fbf3a8: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAttributeRarityEpic) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityEpic#78fbf3a8 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// StarGiftAttributeRarityLegendary represents TL type `starGiftAttributeRarityLegendary#cef7e7a8`.
|
|
//
|
|
// See https://core.telegram.org/constructor/starGiftAttributeRarityLegendary for reference.
|
|
type StarGiftAttributeRarityLegendary struct {
|
|
}
|
|
|
|
// StarGiftAttributeRarityLegendaryTypeID is TL type id of StarGiftAttributeRarityLegendary.
|
|
const StarGiftAttributeRarityLegendaryTypeID = 0xcef7e7a8
|
|
|
|
// construct implements constructor of StarGiftAttributeRarityClass.
|
|
func (s StarGiftAttributeRarityLegendary) construct() StarGiftAttributeRarityClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarGiftAttributeRarityLegendary.
|
|
var (
|
|
_ bin.Encoder = &StarGiftAttributeRarityLegendary{}
|
|
_ bin.Decoder = &StarGiftAttributeRarityLegendary{}
|
|
_ bin.BareEncoder = &StarGiftAttributeRarityLegendary{}
|
|
_ bin.BareDecoder = &StarGiftAttributeRarityLegendary{}
|
|
|
|
_ StarGiftAttributeRarityClass = &StarGiftAttributeRarityLegendary{}
|
|
)
|
|
|
|
func (s *StarGiftAttributeRarityLegendary) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarGiftAttributeRarityLegendary) String() string {
|
|
if s == nil {
|
|
return "StarGiftAttributeRarityLegendary(nil)"
|
|
}
|
|
type Alias StarGiftAttributeRarityLegendary
|
|
return fmt.Sprintf("StarGiftAttributeRarityLegendary%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarGiftAttributeRarityLegendary) TypeID() uint32 {
|
|
return StarGiftAttributeRarityLegendaryTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarGiftAttributeRarityLegendary) TypeName() string {
|
|
return "starGiftAttributeRarityLegendary"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarGiftAttributeRarityLegendary) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starGiftAttributeRarityLegendary",
|
|
ID: StarGiftAttributeRarityLegendaryTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarGiftAttributeRarityLegendary) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil")
|
|
}
|
|
b.PutID(StarGiftAttributeRarityLegendaryTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarGiftAttributeRarityLegendary) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starGiftAttributeRarityLegendary#cef7e7a8 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarGiftAttributeRarityLegendary) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarGiftAttributeRarityLegendaryTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starGiftAttributeRarityLegendary#cef7e7a8: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarGiftAttributeRarityLegendary) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starGiftAttributeRarityLegendary#cef7e7a8 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// StarGiftAttributeRarityClassName is schema name of StarGiftAttributeRarityClass.
|
|
const StarGiftAttributeRarityClassName = "StarGiftAttributeRarity"
|
|
|
|
// StarGiftAttributeRarityClass represents StarGiftAttributeRarity generic type.
|
|
//
|
|
// See https://core.telegram.org/type/StarGiftAttributeRarity for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodeStarGiftAttributeRarity(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.StarGiftAttributeRarity: // starGiftAttributeRarity#36437737
|
|
// case *tg.StarGiftAttributeRarityUncommon: // starGiftAttributeRarityUncommon#dbce6389
|
|
// case *tg.StarGiftAttributeRarityRare: // starGiftAttributeRarityRare#f08d516b
|
|
// case *tg.StarGiftAttributeRarityEpic: // starGiftAttributeRarityEpic#78fbf3a8
|
|
// case *tg.StarGiftAttributeRarityLegendary: // starGiftAttributeRarityLegendary#cef7e7a8
|
|
// default: panic(v)
|
|
// }
|
|
type StarGiftAttributeRarityClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() StarGiftAttributeRarityClass
|
|
|
|
// 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
|
|
}
|
|
|
|
// DecodeStarGiftAttributeRarity implements binary de-serialization for StarGiftAttributeRarityClass.
|
|
func DecodeStarGiftAttributeRarity(buf *bin.Buffer) (StarGiftAttributeRarityClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case StarGiftAttributeRarityTypeID:
|
|
// Decoding starGiftAttributeRarity#36437737.
|
|
v := StarGiftAttributeRarity{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarGiftAttributeRarityUncommonTypeID:
|
|
// Decoding starGiftAttributeRarityUncommon#dbce6389.
|
|
v := StarGiftAttributeRarityUncommon{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarGiftAttributeRarityRareTypeID:
|
|
// Decoding starGiftAttributeRarityRare#f08d516b.
|
|
v := StarGiftAttributeRarityRare{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarGiftAttributeRarityEpicTypeID:
|
|
// Decoding starGiftAttributeRarityEpic#78fbf3a8.
|
|
v := StarGiftAttributeRarityEpic{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarGiftAttributeRarityLegendaryTypeID:
|
|
// Decoding starGiftAttributeRarityLegendary#cef7e7a8.
|
|
v := StarGiftAttributeRarityLegendary{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode StarGiftAttributeRarityClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// StarGiftAttributeRarity boxes the StarGiftAttributeRarityClass providing a helper.
|
|
type StarGiftAttributeRarityBox struct {
|
|
StarGiftAttributeRarity StarGiftAttributeRarityClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for StarGiftAttributeRarityBox.
|
|
func (b *StarGiftAttributeRarityBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode StarGiftAttributeRarityBox to nil")
|
|
}
|
|
v, err := DecodeStarGiftAttributeRarity(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.StarGiftAttributeRarity = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for StarGiftAttributeRarityBox.
|
|
func (b *StarGiftAttributeRarityBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.StarGiftAttributeRarity == nil {
|
|
return fmt.Errorf("unable to encode StarGiftAttributeRarityClass as nil")
|
|
}
|
|
return b.StarGiftAttributeRarity.Encode(buf)
|
|
}
|