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
432 lines
13 KiB
Go
432 lines
13 KiB
Go
// 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{}
|
|
)
|
|
|
|
// StarTransactionDirectionIncoming represents TL type `starTransactionDirectionIncoming#b2cabe46`.
|
|
type StarTransactionDirectionIncoming struct {
|
|
}
|
|
|
|
// StarTransactionDirectionIncomingTypeID is TL type id of StarTransactionDirectionIncoming.
|
|
const StarTransactionDirectionIncomingTypeID = 0xb2cabe46
|
|
|
|
// construct implements constructor of StarTransactionDirectionClass.
|
|
func (s StarTransactionDirectionIncoming) construct() StarTransactionDirectionClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarTransactionDirectionIncoming.
|
|
var (
|
|
_ bin.Encoder = &StarTransactionDirectionIncoming{}
|
|
_ bin.Decoder = &StarTransactionDirectionIncoming{}
|
|
_ bin.BareEncoder = &StarTransactionDirectionIncoming{}
|
|
_ bin.BareDecoder = &StarTransactionDirectionIncoming{}
|
|
|
|
_ StarTransactionDirectionClass = &StarTransactionDirectionIncoming{}
|
|
)
|
|
|
|
func (s *StarTransactionDirectionIncoming) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarTransactionDirectionIncoming) String() string {
|
|
if s == nil {
|
|
return "StarTransactionDirectionIncoming(nil)"
|
|
}
|
|
type Alias StarTransactionDirectionIncoming
|
|
return fmt.Sprintf("StarTransactionDirectionIncoming%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarTransactionDirectionIncoming) TypeID() uint32 {
|
|
return StarTransactionDirectionIncomingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarTransactionDirectionIncoming) TypeName() string {
|
|
return "starTransactionDirectionIncoming"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarTransactionDirectionIncoming) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starTransactionDirectionIncoming",
|
|
ID: StarTransactionDirectionIncomingTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarTransactionDirectionIncoming) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starTransactionDirectionIncoming#b2cabe46 as nil")
|
|
}
|
|
b.PutID(StarTransactionDirectionIncomingTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarTransactionDirectionIncoming) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starTransactionDirectionIncoming#b2cabe46 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarTransactionDirectionIncoming) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starTransactionDirectionIncoming#b2cabe46 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarTransactionDirectionIncomingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starTransactionDirectionIncoming#b2cabe46: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarTransactionDirectionIncoming) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starTransactionDirectionIncoming#b2cabe46 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *StarTransactionDirectionIncoming) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starTransactionDirectionIncoming#b2cabe46 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("starTransactionDirectionIncoming")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *StarTransactionDirectionIncoming) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starTransactionDirectionIncoming#b2cabe46 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("starTransactionDirectionIncoming"); err != nil {
|
|
return fmt.Errorf("unable to decode starTransactionDirectionIncoming#b2cabe46: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// StarTransactionDirectionOutgoing represents TL type `starTransactionDirectionOutgoing#6e83b5a0`.
|
|
type StarTransactionDirectionOutgoing struct {
|
|
}
|
|
|
|
// StarTransactionDirectionOutgoingTypeID is TL type id of StarTransactionDirectionOutgoing.
|
|
const StarTransactionDirectionOutgoingTypeID = 0x6e83b5a0
|
|
|
|
// construct implements constructor of StarTransactionDirectionClass.
|
|
func (s StarTransactionDirectionOutgoing) construct() StarTransactionDirectionClass { return &s }
|
|
|
|
// Ensuring interfaces in compile-time for StarTransactionDirectionOutgoing.
|
|
var (
|
|
_ bin.Encoder = &StarTransactionDirectionOutgoing{}
|
|
_ bin.Decoder = &StarTransactionDirectionOutgoing{}
|
|
_ bin.BareEncoder = &StarTransactionDirectionOutgoing{}
|
|
_ bin.BareDecoder = &StarTransactionDirectionOutgoing{}
|
|
|
|
_ StarTransactionDirectionClass = &StarTransactionDirectionOutgoing{}
|
|
)
|
|
|
|
func (s *StarTransactionDirectionOutgoing) Zero() bool {
|
|
if s == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (s *StarTransactionDirectionOutgoing) String() string {
|
|
if s == nil {
|
|
return "StarTransactionDirectionOutgoing(nil)"
|
|
}
|
|
type Alias StarTransactionDirectionOutgoing
|
|
return fmt.Sprintf("StarTransactionDirectionOutgoing%+v", Alias(*s))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*StarTransactionDirectionOutgoing) TypeID() uint32 {
|
|
return StarTransactionDirectionOutgoingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*StarTransactionDirectionOutgoing) TypeName() string {
|
|
return "starTransactionDirectionOutgoing"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (s *StarTransactionDirectionOutgoing) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "starTransactionDirectionOutgoing",
|
|
ID: StarTransactionDirectionOutgoingTypeID,
|
|
}
|
|
if s == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (s *StarTransactionDirectionOutgoing) Encode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starTransactionDirectionOutgoing#6e83b5a0 as nil")
|
|
}
|
|
b.PutID(StarTransactionDirectionOutgoingTypeID)
|
|
return s.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (s *StarTransactionDirectionOutgoing) EncodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starTransactionDirectionOutgoing#6e83b5a0 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (s *StarTransactionDirectionOutgoing) Decode(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starTransactionDirectionOutgoing#6e83b5a0 to nil")
|
|
}
|
|
if err := b.ConsumeID(StarTransactionDirectionOutgoingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode starTransactionDirectionOutgoing#6e83b5a0: %w", err)
|
|
}
|
|
return s.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (s *StarTransactionDirectionOutgoing) DecodeBare(b *bin.Buffer) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starTransactionDirectionOutgoing#6e83b5a0 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (s *StarTransactionDirectionOutgoing) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't encode starTransactionDirectionOutgoing#6e83b5a0 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("starTransactionDirectionOutgoing")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (s *StarTransactionDirectionOutgoing) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if s == nil {
|
|
return fmt.Errorf("can't decode starTransactionDirectionOutgoing#6e83b5a0 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("starTransactionDirectionOutgoing"); err != nil {
|
|
return fmt.Errorf("unable to decode starTransactionDirectionOutgoing#6e83b5a0: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// StarTransactionDirectionClassName is schema name of StarTransactionDirectionClass.
|
|
const StarTransactionDirectionClassName = "StarTransactionDirection"
|
|
|
|
// StarTransactionDirectionClass represents StarTransactionDirection generic type.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tdapi.DecodeStarTransactionDirection(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tdapi.StarTransactionDirectionIncoming: // starTransactionDirectionIncoming#b2cabe46
|
|
// case *tdapi.StarTransactionDirectionOutgoing: // starTransactionDirectionOutgoing#6e83b5a0
|
|
// default: panic(v)
|
|
// }
|
|
type StarTransactionDirectionClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() StarTransactionDirectionClass
|
|
|
|
// 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
|
|
}
|
|
|
|
// DecodeStarTransactionDirection implements binary de-serialization for StarTransactionDirectionClass.
|
|
func DecodeStarTransactionDirection(buf *bin.Buffer) (StarTransactionDirectionClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case StarTransactionDirectionIncomingTypeID:
|
|
// Decoding starTransactionDirectionIncoming#b2cabe46.
|
|
v := StarTransactionDirectionIncoming{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case StarTransactionDirectionOutgoingTypeID:
|
|
// Decoding starTransactionDirectionOutgoing#6e83b5a0.
|
|
v := StarTransactionDirectionOutgoing{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// DecodeTDLibJSONStarTransactionDirection implements binary de-serialization for StarTransactionDirectionClass.
|
|
func DecodeTDLibJSONStarTransactionDirection(buf tdjson.Decoder) (StarTransactionDirectionClass, error) {
|
|
id, err := buf.FindTypeID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case "starTransactionDirectionIncoming":
|
|
// Decoding starTransactionDirectionIncoming#b2cabe46.
|
|
v := StarTransactionDirectionIncoming{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "starTransactionDirectionOutgoing":
|
|
// Decoding starTransactionDirectionOutgoing#6e83b5a0.
|
|
v := StarTransactionDirectionOutgoing{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", tdjson.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// StarTransactionDirection boxes the StarTransactionDirectionClass providing a helper.
|
|
type StarTransactionDirectionBox struct {
|
|
StarTransactionDirection StarTransactionDirectionClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for StarTransactionDirectionBox.
|
|
func (b *StarTransactionDirectionBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode StarTransactionDirectionBox to nil")
|
|
}
|
|
v, err := DecodeStarTransactionDirection(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.StarTransactionDirection = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for StarTransactionDirectionBox.
|
|
func (b *StarTransactionDirectionBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.StarTransactionDirection == nil {
|
|
return fmt.Errorf("unable to encode StarTransactionDirectionClass as nil")
|
|
}
|
|
return b.StarTransactionDirection.Encode(buf)
|
|
}
|
|
|
|
// DecodeTDLibJSON implements bin.Decoder for StarTransactionDirectionBox.
|
|
func (b *StarTransactionDirectionBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode StarTransactionDirectionBox to nil")
|
|
}
|
|
v, err := DecodeTDLibJSONStarTransactionDirection(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.StarTransactionDirection = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements bin.Encode for StarTransactionDirectionBox.
|
|
func (b *StarTransactionDirectionBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil || b.StarTransactionDirection == nil {
|
|
return fmt.Errorf("unable to encode StarTransactionDirectionClass as nil")
|
|
}
|
|
return b.StarTransactionDirection.EncodeTDLibJSON(buf)
|
|
}
|