7a04f298d2
- 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
471 lines
13 KiB
Go
471 lines
13 KiB
Go
// 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{}
|
|
)
|
|
|
|
// PaidReactionPrivacyDefault represents TL type `paidReactionPrivacyDefault#206ad49e`.
|
|
//
|
|
// See https://core.telegram.org/constructor/paidReactionPrivacyDefault for reference.
|
|
type PaidReactionPrivacyDefault struct {
|
|
}
|
|
|
|
// PaidReactionPrivacyDefaultTypeID is TL type id of PaidReactionPrivacyDefault.
|
|
const PaidReactionPrivacyDefaultTypeID = 0x206ad49e
|
|
|
|
// construct implements constructor of PaidReactionPrivacyClass.
|
|
func (p PaidReactionPrivacyDefault) construct() PaidReactionPrivacyClass { return &p }
|
|
|
|
// Ensuring interfaces in compile-time for PaidReactionPrivacyDefault.
|
|
var (
|
|
_ bin.Encoder = &PaidReactionPrivacyDefault{}
|
|
_ bin.Decoder = &PaidReactionPrivacyDefault{}
|
|
_ bin.BareEncoder = &PaidReactionPrivacyDefault{}
|
|
_ bin.BareDecoder = &PaidReactionPrivacyDefault{}
|
|
|
|
_ PaidReactionPrivacyClass = &PaidReactionPrivacyDefault{}
|
|
)
|
|
|
|
func (p *PaidReactionPrivacyDefault) Zero() bool {
|
|
if p == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (p *PaidReactionPrivacyDefault) String() string {
|
|
if p == nil {
|
|
return "PaidReactionPrivacyDefault(nil)"
|
|
}
|
|
type Alias PaidReactionPrivacyDefault
|
|
return fmt.Sprintf("PaidReactionPrivacyDefault%+v", Alias(*p))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*PaidReactionPrivacyDefault) TypeID() uint32 {
|
|
return PaidReactionPrivacyDefaultTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*PaidReactionPrivacyDefault) TypeName() string {
|
|
return "paidReactionPrivacyDefault"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (p *PaidReactionPrivacyDefault) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "paidReactionPrivacyDefault",
|
|
ID: PaidReactionPrivacyDefaultTypeID,
|
|
}
|
|
if p == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (p *PaidReactionPrivacyDefault) Encode(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't encode paidReactionPrivacyDefault#206ad49e as nil")
|
|
}
|
|
b.PutID(PaidReactionPrivacyDefaultTypeID)
|
|
return p.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (p *PaidReactionPrivacyDefault) EncodeBare(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't encode paidReactionPrivacyDefault#206ad49e as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (p *PaidReactionPrivacyDefault) Decode(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't decode paidReactionPrivacyDefault#206ad49e to nil")
|
|
}
|
|
if err := b.ConsumeID(PaidReactionPrivacyDefaultTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode paidReactionPrivacyDefault#206ad49e: %w", err)
|
|
}
|
|
return p.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (p *PaidReactionPrivacyDefault) DecodeBare(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't decode paidReactionPrivacyDefault#206ad49e to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// PaidReactionPrivacyAnonymous represents TL type `paidReactionPrivacyAnonymous#1f0c1ad9`.
|
|
//
|
|
// See https://core.telegram.org/constructor/paidReactionPrivacyAnonymous for reference.
|
|
type PaidReactionPrivacyAnonymous struct {
|
|
}
|
|
|
|
// PaidReactionPrivacyAnonymousTypeID is TL type id of PaidReactionPrivacyAnonymous.
|
|
const PaidReactionPrivacyAnonymousTypeID = 0x1f0c1ad9
|
|
|
|
// construct implements constructor of PaidReactionPrivacyClass.
|
|
func (p PaidReactionPrivacyAnonymous) construct() PaidReactionPrivacyClass { return &p }
|
|
|
|
// Ensuring interfaces in compile-time for PaidReactionPrivacyAnonymous.
|
|
var (
|
|
_ bin.Encoder = &PaidReactionPrivacyAnonymous{}
|
|
_ bin.Decoder = &PaidReactionPrivacyAnonymous{}
|
|
_ bin.BareEncoder = &PaidReactionPrivacyAnonymous{}
|
|
_ bin.BareDecoder = &PaidReactionPrivacyAnonymous{}
|
|
|
|
_ PaidReactionPrivacyClass = &PaidReactionPrivacyAnonymous{}
|
|
)
|
|
|
|
func (p *PaidReactionPrivacyAnonymous) Zero() bool {
|
|
if p == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (p *PaidReactionPrivacyAnonymous) String() string {
|
|
if p == nil {
|
|
return "PaidReactionPrivacyAnonymous(nil)"
|
|
}
|
|
type Alias PaidReactionPrivacyAnonymous
|
|
return fmt.Sprintf("PaidReactionPrivacyAnonymous%+v", Alias(*p))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*PaidReactionPrivacyAnonymous) TypeID() uint32 {
|
|
return PaidReactionPrivacyAnonymousTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*PaidReactionPrivacyAnonymous) TypeName() string {
|
|
return "paidReactionPrivacyAnonymous"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (p *PaidReactionPrivacyAnonymous) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "paidReactionPrivacyAnonymous",
|
|
ID: PaidReactionPrivacyAnonymousTypeID,
|
|
}
|
|
if p == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (p *PaidReactionPrivacyAnonymous) Encode(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't encode paidReactionPrivacyAnonymous#1f0c1ad9 as nil")
|
|
}
|
|
b.PutID(PaidReactionPrivacyAnonymousTypeID)
|
|
return p.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (p *PaidReactionPrivacyAnonymous) EncodeBare(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't encode paidReactionPrivacyAnonymous#1f0c1ad9 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (p *PaidReactionPrivacyAnonymous) Decode(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't decode paidReactionPrivacyAnonymous#1f0c1ad9 to nil")
|
|
}
|
|
if err := b.ConsumeID(PaidReactionPrivacyAnonymousTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode paidReactionPrivacyAnonymous#1f0c1ad9: %w", err)
|
|
}
|
|
return p.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (p *PaidReactionPrivacyAnonymous) DecodeBare(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't decode paidReactionPrivacyAnonymous#1f0c1ad9 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// PaidReactionPrivacyPeer represents TL type `paidReactionPrivacyPeer#dc6cfcf0`.
|
|
//
|
|
// See https://core.telegram.org/constructor/paidReactionPrivacyPeer for reference.
|
|
type PaidReactionPrivacyPeer struct {
|
|
// Peer field of PaidReactionPrivacyPeer.
|
|
Peer InputPeerClass
|
|
}
|
|
|
|
// PaidReactionPrivacyPeerTypeID is TL type id of PaidReactionPrivacyPeer.
|
|
const PaidReactionPrivacyPeerTypeID = 0xdc6cfcf0
|
|
|
|
// construct implements constructor of PaidReactionPrivacyClass.
|
|
func (p PaidReactionPrivacyPeer) construct() PaidReactionPrivacyClass { return &p }
|
|
|
|
// Ensuring interfaces in compile-time for PaidReactionPrivacyPeer.
|
|
var (
|
|
_ bin.Encoder = &PaidReactionPrivacyPeer{}
|
|
_ bin.Decoder = &PaidReactionPrivacyPeer{}
|
|
_ bin.BareEncoder = &PaidReactionPrivacyPeer{}
|
|
_ bin.BareDecoder = &PaidReactionPrivacyPeer{}
|
|
|
|
_ PaidReactionPrivacyClass = &PaidReactionPrivacyPeer{}
|
|
)
|
|
|
|
func (p *PaidReactionPrivacyPeer) Zero() bool {
|
|
if p == nil {
|
|
return true
|
|
}
|
|
if !(p.Peer == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (p *PaidReactionPrivacyPeer) String() string {
|
|
if p == nil {
|
|
return "PaidReactionPrivacyPeer(nil)"
|
|
}
|
|
type Alias PaidReactionPrivacyPeer
|
|
return fmt.Sprintf("PaidReactionPrivacyPeer%+v", Alias(*p))
|
|
}
|
|
|
|
// FillFrom fills PaidReactionPrivacyPeer from given interface.
|
|
func (p *PaidReactionPrivacyPeer) FillFrom(from interface {
|
|
GetPeer() (value InputPeerClass)
|
|
}) {
|
|
p.Peer = from.GetPeer()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*PaidReactionPrivacyPeer) TypeID() uint32 {
|
|
return PaidReactionPrivacyPeerTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*PaidReactionPrivacyPeer) TypeName() string {
|
|
return "paidReactionPrivacyPeer"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (p *PaidReactionPrivacyPeer) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "paidReactionPrivacyPeer",
|
|
ID: PaidReactionPrivacyPeerTypeID,
|
|
}
|
|
if p == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Peer",
|
|
SchemaName: "peer",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (p *PaidReactionPrivacyPeer) Encode(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't encode paidReactionPrivacyPeer#dc6cfcf0 as nil")
|
|
}
|
|
b.PutID(PaidReactionPrivacyPeerTypeID)
|
|
return p.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (p *PaidReactionPrivacyPeer) EncodeBare(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't encode paidReactionPrivacyPeer#dc6cfcf0 as nil")
|
|
}
|
|
if p.Peer == nil {
|
|
return fmt.Errorf("unable to encode paidReactionPrivacyPeer#dc6cfcf0: field peer is nil")
|
|
}
|
|
if err := p.Peer.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode paidReactionPrivacyPeer#dc6cfcf0: field peer: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (p *PaidReactionPrivacyPeer) Decode(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't decode paidReactionPrivacyPeer#dc6cfcf0 to nil")
|
|
}
|
|
if err := b.ConsumeID(PaidReactionPrivacyPeerTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode paidReactionPrivacyPeer#dc6cfcf0: %w", err)
|
|
}
|
|
return p.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (p *PaidReactionPrivacyPeer) DecodeBare(b *bin.Buffer) error {
|
|
if p == nil {
|
|
return fmt.Errorf("can't decode paidReactionPrivacyPeer#dc6cfcf0 to nil")
|
|
}
|
|
{
|
|
value, err := DecodeInputPeer(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode paidReactionPrivacyPeer#dc6cfcf0: field peer: %w", err)
|
|
}
|
|
p.Peer = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetPeer returns value of Peer field.
|
|
func (p *PaidReactionPrivacyPeer) GetPeer() (value InputPeerClass) {
|
|
if p == nil {
|
|
return
|
|
}
|
|
return p.Peer
|
|
}
|
|
|
|
// PaidReactionPrivacyClassName is schema name of PaidReactionPrivacyClass.
|
|
const PaidReactionPrivacyClassName = "PaidReactionPrivacy"
|
|
|
|
// PaidReactionPrivacyClass represents PaidReactionPrivacy generic type.
|
|
//
|
|
// See https://core.telegram.org/type/PaidReactionPrivacy for reference.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tg.DecodePaidReactionPrivacy(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tg.PaidReactionPrivacyDefault: // paidReactionPrivacyDefault#206ad49e
|
|
// case *tg.PaidReactionPrivacyAnonymous: // paidReactionPrivacyAnonymous#1f0c1ad9
|
|
// case *tg.PaidReactionPrivacyPeer: // paidReactionPrivacyPeer#dc6cfcf0
|
|
// default: panic(v)
|
|
// }
|
|
type PaidReactionPrivacyClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() PaidReactionPrivacyClass
|
|
|
|
// 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
|
|
}
|
|
|
|
// DecodePaidReactionPrivacy implements binary de-serialization for PaidReactionPrivacyClass.
|
|
func DecodePaidReactionPrivacy(buf *bin.Buffer) (PaidReactionPrivacyClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case PaidReactionPrivacyDefaultTypeID:
|
|
// Decoding paidReactionPrivacyDefault#206ad49e.
|
|
v := PaidReactionPrivacyDefault{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode PaidReactionPrivacyClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case PaidReactionPrivacyAnonymousTypeID:
|
|
// Decoding paidReactionPrivacyAnonymous#1f0c1ad9.
|
|
v := PaidReactionPrivacyAnonymous{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode PaidReactionPrivacyClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case PaidReactionPrivacyPeerTypeID:
|
|
// Decoding paidReactionPrivacyPeer#dc6cfcf0.
|
|
v := PaidReactionPrivacyPeer{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode PaidReactionPrivacyClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode PaidReactionPrivacyClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// PaidReactionPrivacy boxes the PaidReactionPrivacyClass providing a helper.
|
|
type PaidReactionPrivacyBox struct {
|
|
PaidReactionPrivacy PaidReactionPrivacyClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for PaidReactionPrivacyBox.
|
|
func (b *PaidReactionPrivacyBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode PaidReactionPrivacyBox to nil")
|
|
}
|
|
v, err := DecodePaidReactionPrivacy(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.PaidReactionPrivacy = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for PaidReactionPrivacyBox.
|
|
func (b *PaidReactionPrivacyBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.PaidReactionPrivacy == nil {
|
|
return fmt.Errorf("unable to encode PaidReactionPrivacyClass as nil")
|
|
}
|
|
return b.PaidReactionPrivacy.Encode(buf)
|
|
}
|