move gotd fork into repo. (#111)
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
@@ -0,0 +1,682 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tdapi
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// UpgradedGiftAttributeIDModel represents TL type `upgradedGiftAttributeIdModel#3ec7e38b`.
|
||||
type UpgradedGiftAttributeIDModel struct {
|
||||
// Identifier of the sticker representing the model
|
||||
StickerID int64
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeIDModelTypeID is TL type id of UpgradedGiftAttributeIDModel.
|
||||
const UpgradedGiftAttributeIDModelTypeID = 0x3ec7e38b
|
||||
|
||||
// construct implements constructor of UpgradedGiftAttributeIDClass.
|
||||
func (u UpgradedGiftAttributeIDModel) construct() UpgradedGiftAttributeIDClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpgradedGiftAttributeIDModel.
|
||||
var (
|
||||
_ bin.Encoder = &UpgradedGiftAttributeIDModel{}
|
||||
_ bin.Decoder = &UpgradedGiftAttributeIDModel{}
|
||||
_ bin.BareEncoder = &UpgradedGiftAttributeIDModel{}
|
||||
_ bin.BareDecoder = &UpgradedGiftAttributeIDModel{}
|
||||
|
||||
_ UpgradedGiftAttributeIDClass = &UpgradedGiftAttributeIDModel{}
|
||||
)
|
||||
|
||||
func (u *UpgradedGiftAttributeIDModel) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
if !(u.StickerID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpgradedGiftAttributeIDModel) String() string {
|
||||
if u == nil {
|
||||
return "UpgradedGiftAttributeIDModel(nil)"
|
||||
}
|
||||
type Alias UpgradedGiftAttributeIDModel
|
||||
return fmt.Sprintf("UpgradedGiftAttributeIDModel%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpgradedGiftAttributeIDModel) TypeID() uint32 {
|
||||
return UpgradedGiftAttributeIDModelTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpgradedGiftAttributeIDModel) TypeName() string {
|
||||
return "upgradedGiftAttributeIdModel"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpgradedGiftAttributeIDModel) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "upgradedGiftAttributeIdModel",
|
||||
ID: UpgradedGiftAttributeIDModelTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "StickerID",
|
||||
SchemaName: "sticker_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpgradedGiftAttributeIDModel) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdModel#3ec7e38b as nil")
|
||||
}
|
||||
b.PutID(UpgradedGiftAttributeIDModelTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpgradedGiftAttributeIDModel) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdModel#3ec7e38b as nil")
|
||||
}
|
||||
b.PutLong(u.StickerID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpgradedGiftAttributeIDModel) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdModel#3ec7e38b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpgradedGiftAttributeIDModelTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdModel#3ec7e38b: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpgradedGiftAttributeIDModel) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdModel#3ec7e38b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdModel#3ec7e38b: field sticker_id: %w", err)
|
||||
}
|
||||
u.StickerID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (u *UpgradedGiftAttributeIDModel) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdModel#3ec7e38b as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("upgradedGiftAttributeIdModel")
|
||||
b.Comma()
|
||||
b.FieldStart("sticker_id")
|
||||
b.PutLong(u.StickerID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (u *UpgradedGiftAttributeIDModel) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdModel#3ec7e38b to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("upgradedGiftAttributeIdModel"); err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdModel#3ec7e38b: %w", err)
|
||||
}
|
||||
case "sticker_id":
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdModel#3ec7e38b: field sticker_id: %w", err)
|
||||
}
|
||||
u.StickerID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetStickerID returns value of StickerID field.
|
||||
func (u *UpgradedGiftAttributeIDModel) GetStickerID() (value int64) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.StickerID
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeIDSymbol represents TL type `upgradedGiftAttributeIdSymbol#46d29428`.
|
||||
type UpgradedGiftAttributeIDSymbol struct {
|
||||
// Identifier of the sticker representing the symbol
|
||||
StickerID int64
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeIDSymbolTypeID is TL type id of UpgradedGiftAttributeIDSymbol.
|
||||
const UpgradedGiftAttributeIDSymbolTypeID = 0x46d29428
|
||||
|
||||
// construct implements constructor of UpgradedGiftAttributeIDClass.
|
||||
func (u UpgradedGiftAttributeIDSymbol) construct() UpgradedGiftAttributeIDClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpgradedGiftAttributeIDSymbol.
|
||||
var (
|
||||
_ bin.Encoder = &UpgradedGiftAttributeIDSymbol{}
|
||||
_ bin.Decoder = &UpgradedGiftAttributeIDSymbol{}
|
||||
_ bin.BareEncoder = &UpgradedGiftAttributeIDSymbol{}
|
||||
_ bin.BareDecoder = &UpgradedGiftAttributeIDSymbol{}
|
||||
|
||||
_ UpgradedGiftAttributeIDClass = &UpgradedGiftAttributeIDSymbol{}
|
||||
)
|
||||
|
||||
func (u *UpgradedGiftAttributeIDSymbol) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
if !(u.StickerID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) String() string {
|
||||
if u == nil {
|
||||
return "UpgradedGiftAttributeIDSymbol(nil)"
|
||||
}
|
||||
type Alias UpgradedGiftAttributeIDSymbol
|
||||
return fmt.Sprintf("UpgradedGiftAttributeIDSymbol%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpgradedGiftAttributeIDSymbol) TypeID() uint32 {
|
||||
return UpgradedGiftAttributeIDSymbolTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpgradedGiftAttributeIDSymbol) TypeName() string {
|
||||
return "upgradedGiftAttributeIdSymbol"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "upgradedGiftAttributeIdSymbol",
|
||||
ID: UpgradedGiftAttributeIDSymbolTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "StickerID",
|
||||
SchemaName: "sticker_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdSymbol#46d29428 as nil")
|
||||
}
|
||||
b.PutID(UpgradedGiftAttributeIDSymbolTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdSymbol#46d29428 as nil")
|
||||
}
|
||||
b.PutLong(u.StickerID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdSymbol#46d29428 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpgradedGiftAttributeIDSymbolTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdSymbol#46d29428: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdSymbol#46d29428 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdSymbol#46d29428: field sticker_id: %w", err)
|
||||
}
|
||||
u.StickerID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdSymbol#46d29428 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("upgradedGiftAttributeIdSymbol")
|
||||
b.Comma()
|
||||
b.FieldStart("sticker_id")
|
||||
b.PutLong(u.StickerID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdSymbol#46d29428 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("upgradedGiftAttributeIdSymbol"); err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdSymbol#46d29428: %w", err)
|
||||
}
|
||||
case "sticker_id":
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdSymbol#46d29428: field sticker_id: %w", err)
|
||||
}
|
||||
u.StickerID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetStickerID returns value of StickerID field.
|
||||
func (u *UpgradedGiftAttributeIDSymbol) GetStickerID() (value int64) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.StickerID
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeIDBackdrop represents TL type `upgradedGiftAttributeIdBackdrop#5724516f`.
|
||||
type UpgradedGiftAttributeIDBackdrop struct {
|
||||
// Identifier of the backdrop
|
||||
BackdropID int32
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeIDBackdropTypeID is TL type id of UpgradedGiftAttributeIDBackdrop.
|
||||
const UpgradedGiftAttributeIDBackdropTypeID = 0x5724516f
|
||||
|
||||
// construct implements constructor of UpgradedGiftAttributeIDClass.
|
||||
func (u UpgradedGiftAttributeIDBackdrop) construct() UpgradedGiftAttributeIDClass { return &u }
|
||||
|
||||
// Ensuring interfaces in compile-time for UpgradedGiftAttributeIDBackdrop.
|
||||
var (
|
||||
_ bin.Encoder = &UpgradedGiftAttributeIDBackdrop{}
|
||||
_ bin.Decoder = &UpgradedGiftAttributeIDBackdrop{}
|
||||
_ bin.BareEncoder = &UpgradedGiftAttributeIDBackdrop{}
|
||||
_ bin.BareDecoder = &UpgradedGiftAttributeIDBackdrop{}
|
||||
|
||||
_ UpgradedGiftAttributeIDClass = &UpgradedGiftAttributeIDBackdrop{}
|
||||
)
|
||||
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) Zero() bool {
|
||||
if u == nil {
|
||||
return true
|
||||
}
|
||||
if !(u.BackdropID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) String() string {
|
||||
if u == nil {
|
||||
return "UpgradedGiftAttributeIDBackdrop(nil)"
|
||||
}
|
||||
type Alias UpgradedGiftAttributeIDBackdrop
|
||||
return fmt.Sprintf("UpgradedGiftAttributeIDBackdrop%+v", Alias(*u))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*UpgradedGiftAttributeIDBackdrop) TypeID() uint32 {
|
||||
return UpgradedGiftAttributeIDBackdropTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*UpgradedGiftAttributeIDBackdrop) TypeName() string {
|
||||
return "upgradedGiftAttributeIdBackdrop"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "upgradedGiftAttributeIdBackdrop",
|
||||
ID: UpgradedGiftAttributeIDBackdropTypeID,
|
||||
}
|
||||
if u == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BackdropID",
|
||||
SchemaName: "backdrop_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) Encode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdBackdrop#5724516f as nil")
|
||||
}
|
||||
b.PutID(UpgradedGiftAttributeIDBackdropTypeID)
|
||||
return u.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) EncodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdBackdrop#5724516f as nil")
|
||||
}
|
||||
b.PutInt32(u.BackdropID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) Decode(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdBackdrop#5724516f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(UpgradedGiftAttributeIDBackdropTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdBackdrop#5724516f: %w", err)
|
||||
}
|
||||
return u.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) DecodeBare(b *bin.Buffer) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdBackdrop#5724516f to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdBackdrop#5724516f: field backdrop_id: %w", err)
|
||||
}
|
||||
u.BackdropID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't encode upgradedGiftAttributeIdBackdrop#5724516f as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("upgradedGiftAttributeIdBackdrop")
|
||||
b.Comma()
|
||||
b.FieldStart("backdrop_id")
|
||||
b.PutInt32(u.BackdropID)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if u == nil {
|
||||
return fmt.Errorf("can't decode upgradedGiftAttributeIdBackdrop#5724516f to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("upgradedGiftAttributeIdBackdrop"); err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdBackdrop#5724516f: %w", err)
|
||||
}
|
||||
case "backdrop_id":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode upgradedGiftAttributeIdBackdrop#5724516f: field backdrop_id: %w", err)
|
||||
}
|
||||
u.BackdropID = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetBackdropID returns value of BackdropID field.
|
||||
func (u *UpgradedGiftAttributeIDBackdrop) GetBackdropID() (value int32) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
return u.BackdropID
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeIDClassName is schema name of UpgradedGiftAttributeIDClass.
|
||||
const UpgradedGiftAttributeIDClassName = "UpgradedGiftAttributeId"
|
||||
|
||||
// UpgradedGiftAttributeIDClass represents UpgradedGiftAttributeId generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tdapi.DecodeUpgradedGiftAttributeID(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tdapi.UpgradedGiftAttributeIDModel: // upgradedGiftAttributeIdModel#3ec7e38b
|
||||
// case *tdapi.UpgradedGiftAttributeIDSymbol: // upgradedGiftAttributeIdSymbol#46d29428
|
||||
// case *tdapi.UpgradedGiftAttributeIDBackdrop: // upgradedGiftAttributeIdBackdrop#5724516f
|
||||
// default: panic(v)
|
||||
// }
|
||||
type UpgradedGiftAttributeIDClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() UpgradedGiftAttributeIDClass
|
||||
|
||||
// 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
|
||||
|
||||
EncodeTDLibJSON(b tdjson.Encoder) error
|
||||
DecodeTDLibJSON(b tdjson.Decoder) error
|
||||
}
|
||||
|
||||
// DecodeUpgradedGiftAttributeID implements binary de-serialization for UpgradedGiftAttributeIDClass.
|
||||
func DecodeUpgradedGiftAttributeID(buf *bin.Buffer) (UpgradedGiftAttributeIDClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case UpgradedGiftAttributeIDModelTypeID:
|
||||
// Decoding upgradedGiftAttributeIdModel#3ec7e38b.
|
||||
v := UpgradedGiftAttributeIDModel{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case UpgradedGiftAttributeIDSymbolTypeID:
|
||||
// Decoding upgradedGiftAttributeIdSymbol#46d29428.
|
||||
v := UpgradedGiftAttributeIDSymbol{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case UpgradedGiftAttributeIDBackdropTypeID:
|
||||
// Decoding upgradedGiftAttributeIdBackdrop#5724516f.
|
||||
v := UpgradedGiftAttributeIDBackdrop{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// DecodeTDLibJSONUpgradedGiftAttributeID implements binary de-serialization for UpgradedGiftAttributeIDClass.
|
||||
func DecodeTDLibJSONUpgradedGiftAttributeID(buf tdjson.Decoder) (UpgradedGiftAttributeIDClass, error) {
|
||||
id, err := buf.FindTypeID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case "upgradedGiftAttributeIdModel":
|
||||
// Decoding upgradedGiftAttributeIdModel#3ec7e38b.
|
||||
v := UpgradedGiftAttributeIDModel{}
|
||||
if err := v.DecodeTDLibJSON(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case "upgradedGiftAttributeIdSymbol":
|
||||
// Decoding upgradedGiftAttributeIdSymbol#46d29428.
|
||||
v := UpgradedGiftAttributeIDSymbol{}
|
||||
if err := v.DecodeTDLibJSON(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case "upgradedGiftAttributeIdBackdrop":
|
||||
// Decoding upgradedGiftAttributeIdBackdrop#5724516f.
|
||||
v := UpgradedGiftAttributeIDBackdrop{}
|
||||
if err := v.DecodeTDLibJSON(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode UpgradedGiftAttributeIDClass: %w", tdjson.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// UpgradedGiftAttributeID boxes the UpgradedGiftAttributeIDClass providing a helper.
|
||||
type UpgradedGiftAttributeIDBox struct {
|
||||
UpgradedGiftAttributeId UpgradedGiftAttributeIDClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for UpgradedGiftAttributeIDBox.
|
||||
func (b *UpgradedGiftAttributeIDBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode UpgradedGiftAttributeIDBox to nil")
|
||||
}
|
||||
v, err := DecodeUpgradedGiftAttributeID(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.UpgradedGiftAttributeId = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for UpgradedGiftAttributeIDBox.
|
||||
func (b *UpgradedGiftAttributeIDBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.UpgradedGiftAttributeId == nil {
|
||||
return fmt.Errorf("unable to encode UpgradedGiftAttributeIDClass as nil")
|
||||
}
|
||||
return b.UpgradedGiftAttributeId.Encode(buf)
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements bin.Decoder for UpgradedGiftAttributeIDBox.
|
||||
func (b *UpgradedGiftAttributeIDBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode UpgradedGiftAttributeIDBox to nil")
|
||||
}
|
||||
v, err := DecodeTDLibJSONUpgradedGiftAttributeID(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.UpgradedGiftAttributeId = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements bin.Encode for UpgradedGiftAttributeIDBox.
|
||||
func (b *UpgradedGiftAttributeIDBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
||||
if b == nil || b.UpgradedGiftAttributeId == nil {
|
||||
return fmt.Errorf("unable to encode UpgradedGiftAttributeIDClass as nil")
|
||||
}
|
||||
return b.UpgradedGiftAttributeId.EncodeTDLibJSON(buf)
|
||||
}
|
||||
Reference in New Issue
Block a user