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,577 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GroupCallVideoQualityThumbnail represents TL type `groupCallVideoQualityThumbnail#e9661380`.
|
||||
type GroupCallVideoQualityThumbnail struct {
|
||||
}
|
||||
|
||||
// GroupCallVideoQualityThumbnailTypeID is TL type id of GroupCallVideoQualityThumbnail.
|
||||
const GroupCallVideoQualityThumbnailTypeID = 0xe9661380
|
||||
|
||||
// construct implements constructor of GroupCallVideoQualityClass.
|
||||
func (g GroupCallVideoQualityThumbnail) construct() GroupCallVideoQualityClass { return &g }
|
||||
|
||||
// Ensuring interfaces in compile-time for GroupCallVideoQualityThumbnail.
|
||||
var (
|
||||
_ bin.Encoder = &GroupCallVideoQualityThumbnail{}
|
||||
_ bin.Decoder = &GroupCallVideoQualityThumbnail{}
|
||||
_ bin.BareEncoder = &GroupCallVideoQualityThumbnail{}
|
||||
_ bin.BareDecoder = &GroupCallVideoQualityThumbnail{}
|
||||
|
||||
_ GroupCallVideoQualityClass = &GroupCallVideoQualityThumbnail{}
|
||||
)
|
||||
|
||||
func (g *GroupCallVideoQualityThumbnail) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GroupCallVideoQualityThumbnail) String() string {
|
||||
if g == nil {
|
||||
return "GroupCallVideoQualityThumbnail(nil)"
|
||||
}
|
||||
type Alias GroupCallVideoQualityThumbnail
|
||||
return fmt.Sprintf("GroupCallVideoQualityThumbnail%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GroupCallVideoQualityThumbnail) TypeID() uint32 {
|
||||
return GroupCallVideoQualityThumbnailTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GroupCallVideoQualityThumbnail) TypeName() string {
|
||||
return "groupCallVideoQualityThumbnail"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GroupCallVideoQualityThumbnail) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "groupCallVideoQualityThumbnail",
|
||||
ID: GroupCallVideoQualityThumbnailTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GroupCallVideoQualityThumbnail) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityThumbnail#e9661380 as nil")
|
||||
}
|
||||
b.PutID(GroupCallVideoQualityThumbnailTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GroupCallVideoQualityThumbnail) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityThumbnail#e9661380 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GroupCallVideoQualityThumbnail) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityThumbnail#e9661380 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GroupCallVideoQualityThumbnailTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallVideoQualityThumbnail#e9661380: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GroupCallVideoQualityThumbnail) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityThumbnail#e9661380 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GroupCallVideoQualityThumbnail) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityThumbnail#e9661380 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("groupCallVideoQualityThumbnail")
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GroupCallVideoQualityThumbnail) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityThumbnail#e9661380 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("groupCallVideoQualityThumbnail"); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallVideoQualityThumbnail#e9661380: %w", err)
|
||||
}
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GroupCallVideoQualityMedium represents TL type `groupCallVideoQualityMedium#178abcaa`.
|
||||
type GroupCallVideoQualityMedium struct {
|
||||
}
|
||||
|
||||
// GroupCallVideoQualityMediumTypeID is TL type id of GroupCallVideoQualityMedium.
|
||||
const GroupCallVideoQualityMediumTypeID = 0x178abcaa
|
||||
|
||||
// construct implements constructor of GroupCallVideoQualityClass.
|
||||
func (g GroupCallVideoQualityMedium) construct() GroupCallVideoQualityClass { return &g }
|
||||
|
||||
// Ensuring interfaces in compile-time for GroupCallVideoQualityMedium.
|
||||
var (
|
||||
_ bin.Encoder = &GroupCallVideoQualityMedium{}
|
||||
_ bin.Decoder = &GroupCallVideoQualityMedium{}
|
||||
_ bin.BareEncoder = &GroupCallVideoQualityMedium{}
|
||||
_ bin.BareDecoder = &GroupCallVideoQualityMedium{}
|
||||
|
||||
_ GroupCallVideoQualityClass = &GroupCallVideoQualityMedium{}
|
||||
)
|
||||
|
||||
func (g *GroupCallVideoQualityMedium) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GroupCallVideoQualityMedium) String() string {
|
||||
if g == nil {
|
||||
return "GroupCallVideoQualityMedium(nil)"
|
||||
}
|
||||
type Alias GroupCallVideoQualityMedium
|
||||
return fmt.Sprintf("GroupCallVideoQualityMedium%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GroupCallVideoQualityMedium) TypeID() uint32 {
|
||||
return GroupCallVideoQualityMediumTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GroupCallVideoQualityMedium) TypeName() string {
|
||||
return "groupCallVideoQualityMedium"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GroupCallVideoQualityMedium) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "groupCallVideoQualityMedium",
|
||||
ID: GroupCallVideoQualityMediumTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GroupCallVideoQualityMedium) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityMedium#178abcaa as nil")
|
||||
}
|
||||
b.PutID(GroupCallVideoQualityMediumTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GroupCallVideoQualityMedium) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityMedium#178abcaa as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GroupCallVideoQualityMedium) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityMedium#178abcaa to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GroupCallVideoQualityMediumTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallVideoQualityMedium#178abcaa: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GroupCallVideoQualityMedium) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityMedium#178abcaa to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GroupCallVideoQualityMedium) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityMedium#178abcaa as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("groupCallVideoQualityMedium")
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GroupCallVideoQualityMedium) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityMedium#178abcaa to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("groupCallVideoQualityMedium"); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallVideoQualityMedium#178abcaa: %w", err)
|
||||
}
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GroupCallVideoQualityFull represents TL type `groupCallVideoQualityFull#81491637`.
|
||||
type GroupCallVideoQualityFull struct {
|
||||
}
|
||||
|
||||
// GroupCallVideoQualityFullTypeID is TL type id of GroupCallVideoQualityFull.
|
||||
const GroupCallVideoQualityFullTypeID = 0x81491637
|
||||
|
||||
// construct implements constructor of GroupCallVideoQualityClass.
|
||||
func (g GroupCallVideoQualityFull) construct() GroupCallVideoQualityClass { return &g }
|
||||
|
||||
// Ensuring interfaces in compile-time for GroupCallVideoQualityFull.
|
||||
var (
|
||||
_ bin.Encoder = &GroupCallVideoQualityFull{}
|
||||
_ bin.Decoder = &GroupCallVideoQualityFull{}
|
||||
_ bin.BareEncoder = &GroupCallVideoQualityFull{}
|
||||
_ bin.BareDecoder = &GroupCallVideoQualityFull{}
|
||||
|
||||
_ GroupCallVideoQualityClass = &GroupCallVideoQualityFull{}
|
||||
)
|
||||
|
||||
func (g *GroupCallVideoQualityFull) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GroupCallVideoQualityFull) String() string {
|
||||
if g == nil {
|
||||
return "GroupCallVideoQualityFull(nil)"
|
||||
}
|
||||
type Alias GroupCallVideoQualityFull
|
||||
return fmt.Sprintf("GroupCallVideoQualityFull%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GroupCallVideoQualityFull) TypeID() uint32 {
|
||||
return GroupCallVideoQualityFullTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GroupCallVideoQualityFull) TypeName() string {
|
||||
return "groupCallVideoQualityFull"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GroupCallVideoQualityFull) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "groupCallVideoQualityFull",
|
||||
ID: GroupCallVideoQualityFullTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GroupCallVideoQualityFull) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityFull#81491637 as nil")
|
||||
}
|
||||
b.PutID(GroupCallVideoQualityFullTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GroupCallVideoQualityFull) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityFull#81491637 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GroupCallVideoQualityFull) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityFull#81491637 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GroupCallVideoQualityFullTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallVideoQualityFull#81491637: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GroupCallVideoQualityFull) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityFull#81491637 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (g *GroupCallVideoQualityFull) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode groupCallVideoQualityFull#81491637 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("groupCallVideoQualityFull")
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (g *GroupCallVideoQualityFull) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode groupCallVideoQualityFull#81491637 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("groupCallVideoQualityFull"); err != nil {
|
||||
return fmt.Errorf("unable to decode groupCallVideoQualityFull#81491637: %w", err)
|
||||
}
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GroupCallVideoQualityClassName is schema name of GroupCallVideoQualityClass.
|
||||
const GroupCallVideoQualityClassName = "GroupCallVideoQuality"
|
||||
|
||||
// GroupCallVideoQualityClass represents GroupCallVideoQuality generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := tdapi.DecodeGroupCallVideoQuality(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *tdapi.GroupCallVideoQualityThumbnail: // groupCallVideoQualityThumbnail#e9661380
|
||||
// case *tdapi.GroupCallVideoQualityMedium: // groupCallVideoQualityMedium#178abcaa
|
||||
// case *tdapi.GroupCallVideoQualityFull: // groupCallVideoQualityFull#81491637
|
||||
// default: panic(v)
|
||||
// }
|
||||
type GroupCallVideoQualityClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() GroupCallVideoQualityClass
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DecodeGroupCallVideoQuality implements binary de-serialization for GroupCallVideoQualityClass.
|
||||
func DecodeGroupCallVideoQuality(buf *bin.Buffer) (GroupCallVideoQualityClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case GroupCallVideoQualityThumbnailTypeID:
|
||||
// Decoding groupCallVideoQualityThumbnail#e9661380.
|
||||
v := GroupCallVideoQualityThumbnail{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case GroupCallVideoQualityMediumTypeID:
|
||||
// Decoding groupCallVideoQualityMedium#178abcaa.
|
||||
v := GroupCallVideoQualityMedium{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case GroupCallVideoQualityFullTypeID:
|
||||
// Decoding groupCallVideoQualityFull#81491637.
|
||||
v := GroupCallVideoQualityFull{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// DecodeTDLibJSONGroupCallVideoQuality implements binary de-serialization for GroupCallVideoQualityClass.
|
||||
func DecodeTDLibJSONGroupCallVideoQuality(buf tdjson.Decoder) (GroupCallVideoQualityClass, error) {
|
||||
id, err := buf.FindTypeID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case "groupCallVideoQualityThumbnail":
|
||||
// Decoding groupCallVideoQualityThumbnail#e9661380.
|
||||
v := GroupCallVideoQualityThumbnail{}
|
||||
if err := v.DecodeTDLibJSON(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case "groupCallVideoQualityMedium":
|
||||
// Decoding groupCallVideoQualityMedium#178abcaa.
|
||||
v := GroupCallVideoQualityMedium{}
|
||||
if err := v.DecodeTDLibJSON(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case "groupCallVideoQualityFull":
|
||||
// Decoding groupCallVideoQualityFull#81491637.
|
||||
v := GroupCallVideoQualityFull{}
|
||||
if err := v.DecodeTDLibJSON(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", tdjson.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// GroupCallVideoQuality boxes the GroupCallVideoQualityClass providing a helper.
|
||||
type GroupCallVideoQualityBox struct {
|
||||
GroupCallVideoQuality GroupCallVideoQualityClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for GroupCallVideoQualityBox.
|
||||
func (b *GroupCallVideoQualityBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode GroupCallVideoQualityBox to nil")
|
||||
}
|
||||
v, err := DecodeGroupCallVideoQuality(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.GroupCallVideoQuality = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for GroupCallVideoQualityBox.
|
||||
func (b *GroupCallVideoQualityBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.GroupCallVideoQuality == nil {
|
||||
return fmt.Errorf("unable to encode GroupCallVideoQualityClass as nil")
|
||||
}
|
||||
return b.GroupCallVideoQuality.Encode(buf)
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements bin.Decoder for GroupCallVideoQualityBox.
|
||||
func (b *GroupCallVideoQualityBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode GroupCallVideoQualityBox to nil")
|
||||
}
|
||||
v, err := DecodeTDLibJSONGroupCallVideoQuality(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.GroupCallVideoQuality = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements bin.Encode for GroupCallVideoQualityBox.
|
||||
func (b *GroupCallVideoQualityBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
||||
if b == nil || b.GroupCallVideoQuality == nil {
|
||||
return fmt.Errorf("unable to encode GroupCallVideoQualityClass as nil")
|
||||
}
|
||||
return b.GroupCallVideoQuality.EncodeTDLibJSON(buf)
|
||||
}
|
||||
Reference in New Issue
Block a user