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,2 @@
|
||||
// Package e2e implements MTProto encoding and decoding.
|
||||
package e2e
|
||||
@@ -0,0 +1,325 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// BoolFalse represents TL type `boolFalse#bc799737`.
|
||||
// Constructor may be interpreted as a booleanfalse value.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/boolFalse for reference.
|
||||
type BoolFalse struct {
|
||||
}
|
||||
|
||||
// BoolFalseTypeID is TL type id of BoolFalse.
|
||||
const BoolFalseTypeID = 0xbc799737
|
||||
|
||||
// construct implements constructor of BoolClass.
|
||||
func (b BoolFalse) construct() BoolClass { return &b }
|
||||
|
||||
// Ensuring interfaces in compile-time for BoolFalse.
|
||||
var (
|
||||
_ bin.Encoder = &BoolFalse{}
|
||||
_ bin.Decoder = &BoolFalse{}
|
||||
_ bin.BareEncoder = &BoolFalse{}
|
||||
_ bin.BareDecoder = &BoolFalse{}
|
||||
|
||||
_ BoolClass = &BoolFalse{}
|
||||
)
|
||||
|
||||
func (b *BoolFalse) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BoolFalse) String() string {
|
||||
if b == nil {
|
||||
return "BoolFalse(nil)"
|
||||
}
|
||||
type Alias BoolFalse
|
||||
return fmt.Sprintf("BoolFalse%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BoolFalse) TypeID() uint32 {
|
||||
return BoolFalseTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BoolFalse) TypeName() string {
|
||||
return "boolFalse"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BoolFalse) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "boolFalse",
|
||||
ID: BoolFalseTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BoolFalse) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolFalse#bc799737 as nil")
|
||||
}
|
||||
buf.PutID(BoolFalseTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BoolFalse) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolFalse#bc799737 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BoolFalse) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolFalse#bc799737 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BoolFalseTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode boolFalse#bc799737: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BoolFalse) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolFalse#bc799737 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BoolTrue represents TL type `boolTrue#997275b5`.
|
||||
// The constructor can be interpreted as a booleantrue value.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/boolTrue for reference.
|
||||
type BoolTrue struct {
|
||||
}
|
||||
|
||||
// BoolTrueTypeID is TL type id of BoolTrue.
|
||||
const BoolTrueTypeID = 0x997275b5
|
||||
|
||||
// construct implements constructor of BoolClass.
|
||||
func (b BoolTrue) construct() BoolClass { return &b }
|
||||
|
||||
// Ensuring interfaces in compile-time for BoolTrue.
|
||||
var (
|
||||
_ bin.Encoder = &BoolTrue{}
|
||||
_ bin.Decoder = &BoolTrue{}
|
||||
_ bin.BareEncoder = &BoolTrue{}
|
||||
_ bin.BareDecoder = &BoolTrue{}
|
||||
|
||||
_ BoolClass = &BoolTrue{}
|
||||
)
|
||||
|
||||
func (b *BoolTrue) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BoolTrue) String() string {
|
||||
if b == nil {
|
||||
return "BoolTrue(nil)"
|
||||
}
|
||||
type Alias BoolTrue
|
||||
return fmt.Sprintf("BoolTrue%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BoolTrue) TypeID() uint32 {
|
||||
return BoolTrueTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BoolTrue) TypeName() string {
|
||||
return "boolTrue"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BoolTrue) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "boolTrue",
|
||||
ID: BoolTrueTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BoolTrue) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolTrue#997275b5 as nil")
|
||||
}
|
||||
buf.PutID(BoolTrueTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BoolTrue) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode boolTrue#997275b5 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BoolTrue) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolTrue#997275b5 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BoolTrueTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode boolTrue#997275b5: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BoolTrue) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode boolTrue#997275b5 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BoolClassName is schema name of BoolClass.
|
||||
const BoolClassName = "Bool"
|
||||
|
||||
// BoolClass represents Bool generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/Bool for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodeBool(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.BoolFalse: // boolFalse#bc799737
|
||||
// case *e2e.BoolTrue: // boolTrue#997275b5
|
||||
// default: panic(v)
|
||||
// }
|
||||
type BoolClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() BoolClass
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DecodeBool implements binary de-serialization for BoolClass.
|
||||
func DecodeBool(buf *bin.Buffer) (BoolClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case BoolFalseTypeID:
|
||||
// Decoding boolFalse#bc799737.
|
||||
v := BoolFalse{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode BoolClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case BoolTrueTypeID:
|
||||
// Decoding boolTrue#997275b5.
|
||||
v := BoolTrue{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode BoolClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode BoolClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// Bool boxes the BoolClass providing a helper.
|
||||
type BoolBox struct {
|
||||
Bool BoolClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for BoolBox.
|
||||
func (b *BoolBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode BoolBox to nil")
|
||||
}
|
||||
v, err := DecodeBool(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.Bool = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for BoolBox.
|
||||
func (b *BoolBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.Bool == nil {
|
||||
return fmt.Errorf("unable to encode BoolClass as nil")
|
||||
}
|
||||
return b.Bool.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Bytes represents TL type `bytes#e937bb82`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/bytes for reference.
|
||||
type Bytes struct {
|
||||
}
|
||||
|
||||
// BytesTypeID is TL type id of Bytes.
|
||||
const BytesTypeID = 0xe937bb82
|
||||
|
||||
// Ensuring interfaces in compile-time for Bytes.
|
||||
var (
|
||||
_ bin.Encoder = &Bytes{}
|
||||
_ bin.Decoder = &Bytes{}
|
||||
_ bin.BareEncoder = &Bytes{}
|
||||
_ bin.BareDecoder = &Bytes{}
|
||||
)
|
||||
|
||||
func (b *Bytes) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *Bytes) String() string {
|
||||
if b == nil {
|
||||
return "Bytes(nil)"
|
||||
}
|
||||
type Alias Bytes
|
||||
return fmt.Sprintf("Bytes%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Bytes) TypeID() uint32 {
|
||||
return BytesTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Bytes) TypeName() string {
|
||||
return "bytes"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *Bytes) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bytes",
|
||||
ID: BytesTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *Bytes) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bytes#e937bb82 as nil")
|
||||
}
|
||||
buf.PutID(BytesTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *Bytes) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bytes#e937bb82 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *Bytes) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bytes#e937bb82 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BytesTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bytes#e937bb82: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *Bytes) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bytes#e937bb82 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Invoker can invoke raw MTProto rpc calls.
|
||||
type Invoker interface {
|
||||
Invoke(ctx context.Context, input bin.Encoder, output bin.Decoder) error
|
||||
}
|
||||
|
||||
// Client implement methods for calling functions from TL schema via Invoker.
|
||||
type Client struct {
|
||||
rpc Invoker
|
||||
}
|
||||
|
||||
// Invoker returns Invoker used by this client.
|
||||
func (c *Client) Invoker() Invoker {
|
||||
return c.rpc
|
||||
}
|
||||
|
||||
// NewClient creates new Client.
|
||||
func NewClient(invoker Invoker) *Client {
|
||||
return &Client{
|
||||
rpc: invoker,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,259 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// DecryptedMessageLayer represents TL type `decryptedMessageLayer#1be31789`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/decryptedMessageLayer for reference.
|
||||
type DecryptedMessageLayer struct {
|
||||
// RandomBytes field of DecryptedMessageLayer.
|
||||
RandomBytes []byte
|
||||
// Layer field of DecryptedMessageLayer.
|
||||
Layer int
|
||||
// InSeqNo field of DecryptedMessageLayer.
|
||||
InSeqNo int
|
||||
// OutSeqNo field of DecryptedMessageLayer.
|
||||
OutSeqNo int
|
||||
// Message field of DecryptedMessageLayer.
|
||||
Message DecryptedMessageClass
|
||||
}
|
||||
|
||||
// DecryptedMessageLayerTypeID is TL type id of DecryptedMessageLayer.
|
||||
const DecryptedMessageLayerTypeID = 0x1be31789
|
||||
|
||||
// Ensuring interfaces in compile-time for DecryptedMessageLayer.
|
||||
var (
|
||||
_ bin.Encoder = &DecryptedMessageLayer{}
|
||||
_ bin.Decoder = &DecryptedMessageLayer{}
|
||||
_ bin.BareEncoder = &DecryptedMessageLayer{}
|
||||
_ bin.BareDecoder = &DecryptedMessageLayer{}
|
||||
)
|
||||
|
||||
func (d *DecryptedMessageLayer) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.RandomBytes == nil) {
|
||||
return false
|
||||
}
|
||||
if !(d.Layer == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.InSeqNo == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.OutSeqNo == 0) {
|
||||
return false
|
||||
}
|
||||
if !(d.Message == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DecryptedMessageLayer) String() string {
|
||||
if d == nil {
|
||||
return "DecryptedMessageLayer(nil)"
|
||||
}
|
||||
type Alias DecryptedMessageLayer
|
||||
return fmt.Sprintf("DecryptedMessageLayer%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DecryptedMessageLayer) TypeID() uint32 {
|
||||
return DecryptedMessageLayerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DecryptedMessageLayer) TypeName() string {
|
||||
return "decryptedMessageLayer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DecryptedMessageLayer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "decryptedMessageLayer",
|
||||
ID: DecryptedMessageLayerTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "RandomBytes",
|
||||
SchemaName: "random_bytes",
|
||||
},
|
||||
{
|
||||
Name: "Layer",
|
||||
SchemaName: "layer",
|
||||
},
|
||||
{
|
||||
Name: "InSeqNo",
|
||||
SchemaName: "in_seq_no",
|
||||
},
|
||||
{
|
||||
Name: "OutSeqNo",
|
||||
SchemaName: "out_seq_no",
|
||||
},
|
||||
{
|
||||
Name: "Message",
|
||||
SchemaName: "message",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DecryptedMessageLayer) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode decryptedMessageLayer#1be31789 as nil")
|
||||
}
|
||||
b.PutID(DecryptedMessageLayerTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DecryptedMessageLayer) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode decryptedMessageLayer#1be31789 as nil")
|
||||
}
|
||||
b.PutBytes(d.RandomBytes)
|
||||
b.PutInt(d.Layer)
|
||||
b.PutInt(d.InSeqNo)
|
||||
b.PutInt(d.OutSeqNo)
|
||||
if d.Message == nil {
|
||||
return fmt.Errorf("unable to encode decryptedMessageLayer#1be31789: field message is nil")
|
||||
}
|
||||
if err := d.Message.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode decryptedMessageLayer#1be31789: field message: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DecryptedMessageLayer) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode decryptedMessageLayer#1be31789 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DecryptedMessageLayerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DecryptedMessageLayer) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode decryptedMessageLayer#1be31789 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field random_bytes: %w", err)
|
||||
}
|
||||
d.RandomBytes = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field layer: %w", err)
|
||||
}
|
||||
d.Layer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field in_seq_no: %w", err)
|
||||
}
|
||||
d.InSeqNo = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field out_seq_no: %w", err)
|
||||
}
|
||||
d.OutSeqNo = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeDecryptedMessage(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode decryptedMessageLayer#1be31789: field message: %w", err)
|
||||
}
|
||||
d.Message = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRandomBytes returns value of RandomBytes field.
|
||||
func (d *DecryptedMessageLayer) GetRandomBytes() (value []byte) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.RandomBytes
|
||||
}
|
||||
|
||||
// GetLayer returns value of Layer field.
|
||||
func (d *DecryptedMessageLayer) GetLayer() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Layer
|
||||
}
|
||||
|
||||
// GetInSeqNo returns value of InSeqNo field.
|
||||
func (d *DecryptedMessageLayer) GetInSeqNo() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.InSeqNo
|
||||
}
|
||||
|
||||
// GetOutSeqNo returns value of OutSeqNo field.
|
||||
func (d *DecryptedMessageLayer) GetOutSeqNo() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.OutSeqNo
|
||||
}
|
||||
|
||||
// GetMessage returns value of Message field.
|
||||
func (d *DecryptedMessageLayer) GetMessage() (value DecryptedMessageClass) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Message
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Double represents TL type `double#2210c154`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/double for reference.
|
||||
type Double struct {
|
||||
}
|
||||
|
||||
// DoubleTypeID is TL type id of Double.
|
||||
const DoubleTypeID = 0x2210c154
|
||||
|
||||
// Ensuring interfaces in compile-time for Double.
|
||||
var (
|
||||
_ bin.Encoder = &Double{}
|
||||
_ bin.Decoder = &Double{}
|
||||
_ bin.BareEncoder = &Double{}
|
||||
_ bin.BareDecoder = &Double{}
|
||||
)
|
||||
|
||||
func (d *Double) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *Double) String() string {
|
||||
if d == nil {
|
||||
return "Double(nil)"
|
||||
}
|
||||
type Alias Double
|
||||
return fmt.Sprintf("Double%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Double) TypeID() uint32 {
|
||||
return DoubleTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Double) TypeName() string {
|
||||
return "double"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *Double) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "double",
|
||||
ID: DoubleTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *Double) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode double#2210c154 as nil")
|
||||
}
|
||||
b.PutID(DoubleTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *Double) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode double#2210c154 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *Double) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode double#2210c154 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DoubleTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode double#2210c154: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *Double) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode double#2210c154 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// FileLocationUnavailable represents TL type `fileLocationUnavailable#7c596b46`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/fileLocationUnavailable for reference.
|
||||
type FileLocationUnavailable struct {
|
||||
// VolumeID field of FileLocationUnavailable.
|
||||
VolumeID int64
|
||||
// LocalID field of FileLocationUnavailable.
|
||||
LocalID int
|
||||
// Secret field of FileLocationUnavailable.
|
||||
Secret int64
|
||||
}
|
||||
|
||||
// FileLocationUnavailableTypeID is TL type id of FileLocationUnavailable.
|
||||
const FileLocationUnavailableTypeID = 0x7c596b46
|
||||
|
||||
// construct implements constructor of FileLocationClass.
|
||||
func (f FileLocationUnavailable) construct() FileLocationClass { return &f }
|
||||
|
||||
// Ensuring interfaces in compile-time for FileLocationUnavailable.
|
||||
var (
|
||||
_ bin.Encoder = &FileLocationUnavailable{}
|
||||
_ bin.Decoder = &FileLocationUnavailable{}
|
||||
_ bin.BareEncoder = &FileLocationUnavailable{}
|
||||
_ bin.BareDecoder = &FileLocationUnavailable{}
|
||||
|
||||
_ FileLocationClass = &FileLocationUnavailable{}
|
||||
)
|
||||
|
||||
func (f *FileLocationUnavailable) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.VolumeID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.LocalID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Secret == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *FileLocationUnavailable) String() string {
|
||||
if f == nil {
|
||||
return "FileLocationUnavailable(nil)"
|
||||
}
|
||||
type Alias FileLocationUnavailable
|
||||
return fmt.Sprintf("FileLocationUnavailable%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*FileLocationUnavailable) TypeID() uint32 {
|
||||
return FileLocationUnavailableTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*FileLocationUnavailable) TypeName() string {
|
||||
return "fileLocationUnavailable"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *FileLocationUnavailable) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "fileLocationUnavailable",
|
||||
ID: FileLocationUnavailableTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "VolumeID",
|
||||
SchemaName: "volume_id",
|
||||
},
|
||||
{
|
||||
Name: "LocalID",
|
||||
SchemaName: "local_id",
|
||||
},
|
||||
{
|
||||
Name: "Secret",
|
||||
SchemaName: "secret",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *FileLocationUnavailable) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocationUnavailable#7c596b46 as nil")
|
||||
}
|
||||
b.PutID(FileLocationUnavailableTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *FileLocationUnavailable) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocationUnavailable#7c596b46 as nil")
|
||||
}
|
||||
b.PutLong(f.VolumeID)
|
||||
b.PutInt(f.LocalID)
|
||||
b.PutLong(f.Secret)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *FileLocationUnavailable) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocationUnavailable#7c596b46 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(FileLocationUnavailableTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *FileLocationUnavailable) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocationUnavailable#7c596b46 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: field volume_id: %w", err)
|
||||
}
|
||||
f.VolumeID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: field local_id: %w", err)
|
||||
}
|
||||
f.LocalID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocationUnavailable#7c596b46: field secret: %w", err)
|
||||
}
|
||||
f.Secret = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetVolumeID returns value of VolumeID field.
|
||||
func (f *FileLocationUnavailable) GetVolumeID() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.VolumeID
|
||||
}
|
||||
|
||||
// GetLocalID returns value of LocalID field.
|
||||
func (f *FileLocationUnavailable) GetLocalID() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.LocalID
|
||||
}
|
||||
|
||||
// GetSecret returns value of Secret field.
|
||||
func (f *FileLocationUnavailable) GetSecret() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Secret
|
||||
}
|
||||
|
||||
// FileLocation represents TL type `fileLocation#53d69076`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/fileLocation for reference.
|
||||
type FileLocation struct {
|
||||
// DCID field of FileLocation.
|
||||
DCID int
|
||||
// VolumeID field of FileLocation.
|
||||
VolumeID int64
|
||||
// LocalID field of FileLocation.
|
||||
LocalID int
|
||||
// Secret field of FileLocation.
|
||||
Secret int64
|
||||
}
|
||||
|
||||
// FileLocationTypeID is TL type id of FileLocation.
|
||||
const FileLocationTypeID = 0x53d69076
|
||||
|
||||
// construct implements constructor of FileLocationClass.
|
||||
func (f FileLocation) construct() FileLocationClass { return &f }
|
||||
|
||||
// Ensuring interfaces in compile-time for FileLocation.
|
||||
var (
|
||||
_ bin.Encoder = &FileLocation{}
|
||||
_ bin.Decoder = &FileLocation{}
|
||||
_ bin.BareEncoder = &FileLocation{}
|
||||
_ bin.BareDecoder = &FileLocation{}
|
||||
|
||||
_ FileLocationClass = &FileLocation{}
|
||||
)
|
||||
|
||||
func (f *FileLocation) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.DCID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.VolumeID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.LocalID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Secret == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *FileLocation) String() string {
|
||||
if f == nil {
|
||||
return "FileLocation(nil)"
|
||||
}
|
||||
type Alias FileLocation
|
||||
return fmt.Sprintf("FileLocation%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*FileLocation) TypeID() uint32 {
|
||||
return FileLocationTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*FileLocation) TypeName() string {
|
||||
return "fileLocation"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *FileLocation) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "fileLocation",
|
||||
ID: FileLocationTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "DCID",
|
||||
SchemaName: "dc_id",
|
||||
},
|
||||
{
|
||||
Name: "VolumeID",
|
||||
SchemaName: "volume_id",
|
||||
},
|
||||
{
|
||||
Name: "LocalID",
|
||||
SchemaName: "local_id",
|
||||
},
|
||||
{
|
||||
Name: "Secret",
|
||||
SchemaName: "secret",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *FileLocation) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocation#53d69076 as nil")
|
||||
}
|
||||
b.PutID(FileLocationTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *FileLocation) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode fileLocation#53d69076 as nil")
|
||||
}
|
||||
b.PutInt(f.DCID)
|
||||
b.PutLong(f.VolumeID)
|
||||
b.PutInt(f.LocalID)
|
||||
b.PutLong(f.Secret)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *FileLocation) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocation#53d69076 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(FileLocationTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *FileLocation) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode fileLocation#53d69076 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field dc_id: %w", err)
|
||||
}
|
||||
f.DCID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field volume_id: %w", err)
|
||||
}
|
||||
f.VolumeID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field local_id: %w", err)
|
||||
}
|
||||
f.LocalID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode fileLocation#53d69076: field secret: %w", err)
|
||||
}
|
||||
f.Secret = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDCID returns value of DCID field.
|
||||
func (f *FileLocation) GetDCID() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.DCID
|
||||
}
|
||||
|
||||
// GetVolumeID returns value of VolumeID field.
|
||||
func (f *FileLocation) GetVolumeID() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.VolumeID
|
||||
}
|
||||
|
||||
// GetLocalID returns value of LocalID field.
|
||||
func (f *FileLocation) GetLocalID() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.LocalID
|
||||
}
|
||||
|
||||
// GetSecret returns value of Secret field.
|
||||
func (f *FileLocation) GetSecret() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Secret
|
||||
}
|
||||
|
||||
// FileLocationClassName is schema name of FileLocationClass.
|
||||
const FileLocationClassName = "FileLocation"
|
||||
|
||||
// FileLocationClass represents FileLocation generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/FileLocation for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodeFileLocation(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.FileLocationUnavailable: // fileLocationUnavailable#7c596b46
|
||||
// case *e2e.FileLocation: // fileLocation#53d69076
|
||||
// default: panic(v)
|
||||
// }
|
||||
type FileLocationClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() FileLocationClass
|
||||
|
||||
// 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
|
||||
|
||||
// VolumeID field of FileLocationUnavailable.
|
||||
GetVolumeID() (value int64)
|
||||
// LocalID field of FileLocationUnavailable.
|
||||
GetLocalID() (value int)
|
||||
// Secret field of FileLocationUnavailable.
|
||||
GetSecret() (value int64)
|
||||
}
|
||||
|
||||
// DecodeFileLocation implements binary de-serialization for FileLocationClass.
|
||||
func DecodeFileLocation(buf *bin.Buffer) (FileLocationClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case FileLocationUnavailableTypeID:
|
||||
// Decoding fileLocationUnavailable#7c596b46.
|
||||
v := FileLocationUnavailable{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode FileLocationClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case FileLocationTypeID:
|
||||
// Decoding fileLocation#53d69076.
|
||||
v := FileLocation{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode FileLocationClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode FileLocationClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// FileLocation boxes the FileLocationClass providing a helper.
|
||||
type FileLocationBox struct {
|
||||
FileLocation FileLocationClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for FileLocationBox.
|
||||
func (b *FileLocationBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode FileLocationBox to nil")
|
||||
}
|
||||
v, err := DecodeFileLocation(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.FileLocation = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for FileLocationBox.
|
||||
func (b *FileLocationBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.FileLocation == nil {
|
||||
return fmt.Errorf("unable to encode FileLocationClass as nil")
|
||||
}
|
||||
return b.FileLocation.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// InputStickerSetShortName represents TL type `inputStickerSetShortName#861cc8a0`.
|
||||
// Stickerset by short name, from a stickerset deep link »¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/links#stickerset-links
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputStickerSetShortName for reference.
|
||||
type InputStickerSetShortName struct {
|
||||
// Short name from a stickerset deep link »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/links#stickerset-links
|
||||
ShortName string
|
||||
}
|
||||
|
||||
// InputStickerSetShortNameTypeID is TL type id of InputStickerSetShortName.
|
||||
const InputStickerSetShortNameTypeID = 0x861cc8a0
|
||||
|
||||
// construct implements constructor of InputStickerSetClass.
|
||||
func (i InputStickerSetShortName) construct() InputStickerSetClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputStickerSetShortName.
|
||||
var (
|
||||
_ bin.Encoder = &InputStickerSetShortName{}
|
||||
_ bin.Decoder = &InputStickerSetShortName{}
|
||||
_ bin.BareEncoder = &InputStickerSetShortName{}
|
||||
_ bin.BareDecoder = &InputStickerSetShortName{}
|
||||
|
||||
_ InputStickerSetClass = &InputStickerSetShortName{}
|
||||
)
|
||||
|
||||
func (i *InputStickerSetShortName) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.ShortName == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputStickerSetShortName) String() string {
|
||||
if i == nil {
|
||||
return "InputStickerSetShortName(nil)"
|
||||
}
|
||||
type Alias InputStickerSetShortName
|
||||
return fmt.Sprintf("InputStickerSetShortName%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputStickerSetShortName) TypeID() uint32 {
|
||||
return InputStickerSetShortNameTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputStickerSetShortName) TypeName() string {
|
||||
return "inputStickerSetShortName"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputStickerSetShortName) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputStickerSetShortName",
|
||||
ID: InputStickerSetShortNameTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ShortName",
|
||||
SchemaName: "short_name",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputStickerSetShortName) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetShortName#861cc8a0 as nil")
|
||||
}
|
||||
b.PutID(InputStickerSetShortNameTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputStickerSetShortName) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetShortName#861cc8a0 as nil")
|
||||
}
|
||||
b.PutString(i.ShortName)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputStickerSetShortName) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetShortName#861cc8a0 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputStickerSetShortNameTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputStickerSetShortName#861cc8a0: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputStickerSetShortName) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetShortName#861cc8a0 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputStickerSetShortName#861cc8a0: field short_name: %w", err)
|
||||
}
|
||||
i.ShortName = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetShortName returns value of ShortName field.
|
||||
func (i *InputStickerSetShortName) GetShortName() (value string) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ShortName
|
||||
}
|
||||
|
||||
// InputStickerSetEmpty represents TL type `inputStickerSetEmpty#ffb62b95`.
|
||||
// Empty constructor
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputStickerSetEmpty for reference.
|
||||
type InputStickerSetEmpty struct {
|
||||
}
|
||||
|
||||
// InputStickerSetEmptyTypeID is TL type id of InputStickerSetEmpty.
|
||||
const InputStickerSetEmptyTypeID = 0xffb62b95
|
||||
|
||||
// construct implements constructor of InputStickerSetClass.
|
||||
func (i InputStickerSetEmpty) construct() InputStickerSetClass { return &i }
|
||||
|
||||
// Ensuring interfaces in compile-time for InputStickerSetEmpty.
|
||||
var (
|
||||
_ bin.Encoder = &InputStickerSetEmpty{}
|
||||
_ bin.Decoder = &InputStickerSetEmpty{}
|
||||
_ bin.BareEncoder = &InputStickerSetEmpty{}
|
||||
_ bin.BareDecoder = &InputStickerSetEmpty{}
|
||||
|
||||
_ InputStickerSetClass = &InputStickerSetEmpty{}
|
||||
)
|
||||
|
||||
func (i *InputStickerSetEmpty) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputStickerSetEmpty) String() string {
|
||||
if i == nil {
|
||||
return "InputStickerSetEmpty(nil)"
|
||||
}
|
||||
type Alias InputStickerSetEmpty
|
||||
return fmt.Sprintf("InputStickerSetEmpty%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputStickerSetEmpty) TypeID() uint32 {
|
||||
return InputStickerSetEmptyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputStickerSetEmpty) TypeName() string {
|
||||
return "inputStickerSetEmpty"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputStickerSetEmpty) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputStickerSetEmpty",
|
||||
ID: InputStickerSetEmptyTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputStickerSetEmpty) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetEmpty#ffb62b95 as nil")
|
||||
}
|
||||
b.PutID(InputStickerSetEmptyTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputStickerSetEmpty) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputStickerSetEmpty#ffb62b95 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputStickerSetEmpty) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetEmpty#ffb62b95 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputStickerSetEmptyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputStickerSetEmpty#ffb62b95: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputStickerSetEmpty) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputStickerSetEmpty#ffb62b95 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InputStickerSetClassName is schema name of InputStickerSetClass.
|
||||
const InputStickerSetClassName = "InputStickerSet"
|
||||
|
||||
// InputStickerSetClass represents InputStickerSet generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/InputStickerSet for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodeInputStickerSet(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.InputStickerSetShortName: // inputStickerSetShortName#861cc8a0
|
||||
// case *e2e.InputStickerSetEmpty: // inputStickerSetEmpty#ffb62b95
|
||||
// default: panic(v)
|
||||
// }
|
||||
type InputStickerSetClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() InputStickerSetClass
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DecodeInputStickerSet implements binary de-serialization for InputStickerSetClass.
|
||||
func DecodeInputStickerSet(buf *bin.Buffer) (InputStickerSetClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case InputStickerSetShortNameTypeID:
|
||||
// Decoding inputStickerSetShortName#861cc8a0.
|
||||
v := InputStickerSetShortName{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case InputStickerSetEmptyTypeID:
|
||||
// Decoding inputStickerSetEmpty#ffb62b95.
|
||||
v := InputStickerSetEmpty{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode InputStickerSetClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// InputStickerSet boxes the InputStickerSetClass providing a helper.
|
||||
type InputStickerSetBox struct {
|
||||
InputStickerSet InputStickerSetClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for InputStickerSetBox.
|
||||
func (b *InputStickerSetBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode InputStickerSetBox to nil")
|
||||
}
|
||||
v, err := DecodeInputStickerSet(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.InputStickerSet = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for InputStickerSetBox.
|
||||
func (b *InputStickerSetBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.InputStickerSet == nil {
|
||||
return fmt.Errorf("unable to encode InputStickerSetClass as nil")
|
||||
}
|
||||
return b.InputStickerSet.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Int represents TL type `int#a8509bda`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/int for reference.
|
||||
type Int struct {
|
||||
}
|
||||
|
||||
// IntTypeID is TL type id of Int.
|
||||
const IntTypeID = 0xa8509bda
|
||||
|
||||
// Ensuring interfaces in compile-time for Int.
|
||||
var (
|
||||
_ bin.Encoder = &Int{}
|
||||
_ bin.Decoder = &Int{}
|
||||
_ bin.BareEncoder = &Int{}
|
||||
_ bin.BareDecoder = &Int{}
|
||||
)
|
||||
|
||||
func (i *Int) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *Int) String() string {
|
||||
if i == nil {
|
||||
return "Int(nil)"
|
||||
}
|
||||
type Alias Int
|
||||
return fmt.Sprintf("Int%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Int) TypeID() uint32 {
|
||||
return IntTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Int) TypeName() string {
|
||||
return "int"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *Int) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "int",
|
||||
ID: IntTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *Int) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode int#a8509bda as nil")
|
||||
}
|
||||
b.PutID(IntTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *Int) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode int#a8509bda as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *Int) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode int#a8509bda to nil")
|
||||
}
|
||||
if err := b.ConsumeID(IntTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode int#a8509bda: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *Int) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode int#a8509bda to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// Long represents TL type `long#22076cba`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/long for reference.
|
||||
type Long struct {
|
||||
}
|
||||
|
||||
// LongTypeID is TL type id of Long.
|
||||
const LongTypeID = 0x22076cba
|
||||
|
||||
// Ensuring interfaces in compile-time for Long.
|
||||
var (
|
||||
_ bin.Encoder = &Long{}
|
||||
_ bin.Decoder = &Long{}
|
||||
_ bin.BareEncoder = &Long{}
|
||||
_ bin.BareDecoder = &Long{}
|
||||
)
|
||||
|
||||
func (l *Long) Zero() bool {
|
||||
if l == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (l *Long) String() string {
|
||||
if l == nil {
|
||||
return "Long(nil)"
|
||||
}
|
||||
type Alias Long
|
||||
return fmt.Sprintf("Long%+v", Alias(*l))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Long) TypeID() uint32 {
|
||||
return LongTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Long) TypeName() string {
|
||||
return "long"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (l *Long) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "long",
|
||||
ID: LongTypeID,
|
||||
}
|
||||
if l == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (l *Long) Encode(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't encode long#22076cba as nil")
|
||||
}
|
||||
b.PutID(LongTypeID)
|
||||
return l.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (l *Long) EncodeBare(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't encode long#22076cba as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (l *Long) Decode(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't decode long#22076cba to nil")
|
||||
}
|
||||
if err := b.ConsumeID(LongTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode long#22076cba: %w", err)
|
||||
}
|
||||
return l.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (l *Long) DecodeBare(b *bin.Buffer) error {
|
||||
if l == nil {
|
||||
return fmt.Errorf("can't decode long#22076cba to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,735 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// PhotoSizeEmpty represents TL type `photoSizeEmpty#e17e23c`.
|
||||
// Empty constructor. Image with this thumbnail is unavailable.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/photoSizeEmpty for reference.
|
||||
type PhotoSizeEmpty struct {
|
||||
// Thumbnail type »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/files#image-thumbnail-types
|
||||
Type string
|
||||
}
|
||||
|
||||
// PhotoSizeEmptyTypeID is TL type id of PhotoSizeEmpty.
|
||||
const PhotoSizeEmptyTypeID = 0xe17e23c
|
||||
|
||||
// construct implements constructor of PhotoSizeClass.
|
||||
func (p PhotoSizeEmpty) construct() PhotoSizeClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PhotoSizeEmpty.
|
||||
var (
|
||||
_ bin.Encoder = &PhotoSizeEmpty{}
|
||||
_ bin.Decoder = &PhotoSizeEmpty{}
|
||||
_ bin.BareEncoder = &PhotoSizeEmpty{}
|
||||
_ bin.BareDecoder = &PhotoSizeEmpty{}
|
||||
|
||||
_ PhotoSizeClass = &PhotoSizeEmpty{}
|
||||
)
|
||||
|
||||
func (p *PhotoSizeEmpty) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Type == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PhotoSizeEmpty) String() string {
|
||||
if p == nil {
|
||||
return "PhotoSizeEmpty(nil)"
|
||||
}
|
||||
type Alias PhotoSizeEmpty
|
||||
return fmt.Sprintf("PhotoSizeEmpty%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PhotoSizeEmpty) TypeID() uint32 {
|
||||
return PhotoSizeEmptyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PhotoSizeEmpty) TypeName() string {
|
||||
return "photoSizeEmpty"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PhotoSizeEmpty) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "photoSizeEmpty",
|
||||
ID: PhotoSizeEmptyTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Type",
|
||||
SchemaName: "type",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PhotoSizeEmpty) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSizeEmpty#e17e23c as nil")
|
||||
}
|
||||
b.PutID(PhotoSizeEmptyTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PhotoSizeEmpty) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSizeEmpty#e17e23c as nil")
|
||||
}
|
||||
b.PutString(p.Type)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PhotoSizeEmpty) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSizeEmpty#e17e23c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PhotoSizeEmptyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode photoSizeEmpty#e17e23c: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PhotoSizeEmpty) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSizeEmpty#e17e23c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSizeEmpty#e17e23c: field type: %w", err)
|
||||
}
|
||||
p.Type = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns value of Type field.
|
||||
func (p *PhotoSizeEmpty) GetType() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Type
|
||||
}
|
||||
|
||||
// PhotoSize represents TL type `photoSize#77bfb61b`.
|
||||
// Image description.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/photoSize for reference.
|
||||
type PhotoSize struct {
|
||||
// Thumbnail type »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/files#image-thumbnail-types
|
||||
Type string
|
||||
// Location field of PhotoSize.
|
||||
Location FileLocationClass
|
||||
// Image width
|
||||
W int
|
||||
// Image height
|
||||
H int
|
||||
// File size
|
||||
Size int
|
||||
}
|
||||
|
||||
// PhotoSizeTypeID is TL type id of PhotoSize.
|
||||
const PhotoSizeTypeID = 0x77bfb61b
|
||||
|
||||
// construct implements constructor of PhotoSizeClass.
|
||||
func (p PhotoSize) construct() PhotoSizeClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PhotoSize.
|
||||
var (
|
||||
_ bin.Encoder = &PhotoSize{}
|
||||
_ bin.Decoder = &PhotoSize{}
|
||||
_ bin.BareEncoder = &PhotoSize{}
|
||||
_ bin.BareDecoder = &PhotoSize{}
|
||||
|
||||
_ PhotoSizeClass = &PhotoSize{}
|
||||
)
|
||||
|
||||
func (p *PhotoSize) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Type == "") {
|
||||
return false
|
||||
}
|
||||
if !(p.Location == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.W == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.H == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.Size == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PhotoSize) String() string {
|
||||
if p == nil {
|
||||
return "PhotoSize(nil)"
|
||||
}
|
||||
type Alias PhotoSize
|
||||
return fmt.Sprintf("PhotoSize%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PhotoSize) TypeID() uint32 {
|
||||
return PhotoSizeTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PhotoSize) TypeName() string {
|
||||
return "photoSize"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PhotoSize) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "photoSize",
|
||||
ID: PhotoSizeTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Type",
|
||||
SchemaName: "type",
|
||||
},
|
||||
{
|
||||
Name: "Location",
|
||||
SchemaName: "location",
|
||||
},
|
||||
{
|
||||
Name: "W",
|
||||
SchemaName: "w",
|
||||
},
|
||||
{
|
||||
Name: "H",
|
||||
SchemaName: "h",
|
||||
},
|
||||
{
|
||||
Name: "Size",
|
||||
SchemaName: "size",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PhotoSize) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSize#77bfb61b as nil")
|
||||
}
|
||||
b.PutID(PhotoSizeTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PhotoSize) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoSize#77bfb61b as nil")
|
||||
}
|
||||
b.PutString(p.Type)
|
||||
if p.Location == nil {
|
||||
return fmt.Errorf("unable to encode photoSize#77bfb61b: field location is nil")
|
||||
}
|
||||
if err := p.Location.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode photoSize#77bfb61b: field location: %w", err)
|
||||
}
|
||||
b.PutInt(p.W)
|
||||
b.PutInt(p.H)
|
||||
b.PutInt(p.Size)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PhotoSize) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSize#77bfb61b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PhotoSizeTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PhotoSize) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoSize#77bfb61b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field type: %w", err)
|
||||
}
|
||||
p.Type = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeFileLocation(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field location: %w", err)
|
||||
}
|
||||
p.Location = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field w: %w", err)
|
||||
}
|
||||
p.W = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field h: %w", err)
|
||||
}
|
||||
p.H = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoSize#77bfb61b: field size: %w", err)
|
||||
}
|
||||
p.Size = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns value of Type field.
|
||||
func (p *PhotoSize) GetType() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Type
|
||||
}
|
||||
|
||||
// GetLocation returns value of Location field.
|
||||
func (p *PhotoSize) GetLocation() (value FileLocationClass) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Location
|
||||
}
|
||||
|
||||
// GetW returns value of W field.
|
||||
func (p *PhotoSize) GetW() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.W
|
||||
}
|
||||
|
||||
// GetH returns value of H field.
|
||||
func (p *PhotoSize) GetH() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.H
|
||||
}
|
||||
|
||||
// GetSize returns value of Size field.
|
||||
func (p *PhotoSize) GetSize() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Size
|
||||
}
|
||||
|
||||
// PhotoCachedSize represents TL type `photoCachedSize#e9a734fa`.
|
||||
// Description of an image and its content.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/photoCachedSize for reference.
|
||||
type PhotoCachedSize struct {
|
||||
// Thumbnail type
|
||||
Type string
|
||||
// Location field of PhotoCachedSize.
|
||||
Location FileLocationClass
|
||||
// Image width
|
||||
W int
|
||||
// Image height
|
||||
H int
|
||||
// Binary data, file content
|
||||
Bytes []byte
|
||||
}
|
||||
|
||||
// PhotoCachedSizeTypeID is TL type id of PhotoCachedSize.
|
||||
const PhotoCachedSizeTypeID = 0xe9a734fa
|
||||
|
||||
// construct implements constructor of PhotoSizeClass.
|
||||
func (p PhotoCachedSize) construct() PhotoSizeClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PhotoCachedSize.
|
||||
var (
|
||||
_ bin.Encoder = &PhotoCachedSize{}
|
||||
_ bin.Decoder = &PhotoCachedSize{}
|
||||
_ bin.BareEncoder = &PhotoCachedSize{}
|
||||
_ bin.BareDecoder = &PhotoCachedSize{}
|
||||
|
||||
_ PhotoSizeClass = &PhotoCachedSize{}
|
||||
)
|
||||
|
||||
func (p *PhotoCachedSize) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Type == "") {
|
||||
return false
|
||||
}
|
||||
if !(p.Location == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.W == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.H == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.Bytes == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PhotoCachedSize) String() string {
|
||||
if p == nil {
|
||||
return "PhotoCachedSize(nil)"
|
||||
}
|
||||
type Alias PhotoCachedSize
|
||||
return fmt.Sprintf("PhotoCachedSize%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PhotoCachedSize) TypeID() uint32 {
|
||||
return PhotoCachedSizeTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PhotoCachedSize) TypeName() string {
|
||||
return "photoCachedSize"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PhotoCachedSize) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "photoCachedSize",
|
||||
ID: PhotoCachedSizeTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Type",
|
||||
SchemaName: "type",
|
||||
},
|
||||
{
|
||||
Name: "Location",
|
||||
SchemaName: "location",
|
||||
},
|
||||
{
|
||||
Name: "W",
|
||||
SchemaName: "w",
|
||||
},
|
||||
{
|
||||
Name: "H",
|
||||
SchemaName: "h",
|
||||
},
|
||||
{
|
||||
Name: "Bytes",
|
||||
SchemaName: "bytes",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PhotoCachedSize) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoCachedSize#e9a734fa as nil")
|
||||
}
|
||||
b.PutID(PhotoCachedSizeTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PhotoCachedSize) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode photoCachedSize#e9a734fa as nil")
|
||||
}
|
||||
b.PutString(p.Type)
|
||||
if p.Location == nil {
|
||||
return fmt.Errorf("unable to encode photoCachedSize#e9a734fa: field location is nil")
|
||||
}
|
||||
if err := p.Location.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode photoCachedSize#e9a734fa: field location: %w", err)
|
||||
}
|
||||
b.PutInt(p.W)
|
||||
b.PutInt(p.H)
|
||||
b.PutBytes(p.Bytes)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PhotoCachedSize) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoCachedSize#e9a734fa to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PhotoCachedSizeTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PhotoCachedSize) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode photoCachedSize#e9a734fa to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field type: %w", err)
|
||||
}
|
||||
p.Type = value
|
||||
}
|
||||
{
|
||||
value, err := DecodeFileLocation(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field location: %w", err)
|
||||
}
|
||||
p.Location = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field w: %w", err)
|
||||
}
|
||||
p.W = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field h: %w", err)
|
||||
}
|
||||
p.H = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode photoCachedSize#e9a734fa: field bytes: %w", err)
|
||||
}
|
||||
p.Bytes = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetType returns value of Type field.
|
||||
func (p *PhotoCachedSize) GetType() (value string) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Type
|
||||
}
|
||||
|
||||
// GetLocation returns value of Location field.
|
||||
func (p *PhotoCachedSize) GetLocation() (value FileLocationClass) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Location
|
||||
}
|
||||
|
||||
// GetW returns value of W field.
|
||||
func (p *PhotoCachedSize) GetW() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.W
|
||||
}
|
||||
|
||||
// GetH returns value of H field.
|
||||
func (p *PhotoCachedSize) GetH() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.H
|
||||
}
|
||||
|
||||
// GetBytes returns value of Bytes field.
|
||||
func (p *PhotoCachedSize) GetBytes() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Bytes
|
||||
}
|
||||
|
||||
// PhotoSizeClassName is schema name of PhotoSizeClass.
|
||||
const PhotoSizeClassName = "PhotoSize"
|
||||
|
||||
// PhotoSizeClass represents PhotoSize generic type.
|
||||
//
|
||||
// See https://core.telegram.org/type/PhotoSize for reference.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := e2e.DecodePhotoSize(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *e2e.PhotoSizeEmpty: // photoSizeEmpty#e17e23c
|
||||
// case *e2e.PhotoSize: // photoSize#77bfb61b
|
||||
// case *e2e.PhotoCachedSize: // photoCachedSize#e9a734fa
|
||||
// default: panic(v)
|
||||
// }
|
||||
type PhotoSizeClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() PhotoSizeClass
|
||||
|
||||
// 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
|
||||
|
||||
// Thumbnail type »¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/files#image-thumbnail-types
|
||||
GetType() (value string)
|
||||
}
|
||||
|
||||
// DecodePhotoSize implements binary de-serialization for PhotoSizeClass.
|
||||
func DecodePhotoSize(buf *bin.Buffer) (PhotoSizeClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case PhotoSizeEmptyTypeID:
|
||||
// Decoding photoSizeEmpty#e17e23c.
|
||||
v := PhotoSizeEmpty{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case PhotoSizeTypeID:
|
||||
// Decoding photoSize#77bfb61b.
|
||||
v := PhotoSize{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case PhotoCachedSizeTypeID:
|
||||
// Decoding photoCachedSize#e9a734fa.
|
||||
v := PhotoCachedSize{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// PhotoSize boxes the PhotoSizeClass providing a helper.
|
||||
type PhotoSizeBox struct {
|
||||
PhotoSize PhotoSizeClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for PhotoSizeBox.
|
||||
func (b *PhotoSizeBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode PhotoSizeBox to nil")
|
||||
}
|
||||
v, err := DecodePhotoSize(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.PhotoSize = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for PhotoSizeBox.
|
||||
func (b *PhotoSizeBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.PhotoSize == nil {
|
||||
return fmt.Errorf("unable to encode PhotoSizeClass as nil")
|
||||
}
|
||||
return b.PhotoSize.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// TypesMap returns mapping from type ids to TL type names.
|
||||
func TypesMap() map[uint32]string {
|
||||
return map[uint32]string{
|
||||
IntTypeID: "int#a8509bda",
|
||||
LongTypeID: "long#22076cba",
|
||||
DoubleTypeID: "double#2210c154",
|
||||
StringTypeID: "string#b5286e24",
|
||||
BytesTypeID: "bytes#e937bb82",
|
||||
BoolFalseTypeID: "boolFalse#bc799737",
|
||||
BoolTrueTypeID: "boolTrue#997275b5",
|
||||
TrueTypeID: "true#3fedd339",
|
||||
DecryptedMessage8TypeID: "decryptedMessage8#1f814f1f",
|
||||
DecryptedMessageService8TypeID: "decryptedMessageService8#aa48327d",
|
||||
DecryptedMessageMediaEmptyTypeID: "decryptedMessageMediaEmpty#89f5c4a",
|
||||
DecryptedMessageMediaPhoto8TypeID: "decryptedMessageMediaPhoto8#32798a8c",
|
||||
DecryptedMessageMediaVideo8TypeID: "decryptedMessageMediaVideo8#4cee6ef3",
|
||||
DecryptedMessageMediaGeoPointTypeID: "decryptedMessageMediaGeoPoint#35480a59",
|
||||
DecryptedMessageMediaContactTypeID: "decryptedMessageMediaContact#588a0a97",
|
||||
DecryptedMessageActionSetMessageTTLTypeID: "decryptedMessageActionSetMessageTTL#a1733aec",
|
||||
DecryptedMessageMediaDocument8TypeID: "decryptedMessageMediaDocument8#b095434b",
|
||||
DecryptedMessageMediaAudio8TypeID: "decryptedMessageMediaAudio8#6080758f",
|
||||
DecryptedMessageActionReadMessagesTypeID: "decryptedMessageActionReadMessages#c4f40be",
|
||||
DecryptedMessageActionDeleteMessagesTypeID: "decryptedMessageActionDeleteMessages#65614304",
|
||||
DecryptedMessageActionScreenshotMessagesTypeID: "decryptedMessageActionScreenshotMessages#8ac1f475",
|
||||
DecryptedMessageActionFlushHistoryTypeID: "decryptedMessageActionFlushHistory#6719e45c",
|
||||
DecryptedMessage23TypeID: "decryptedMessage23#204d3878",
|
||||
DecryptedMessageServiceTypeID: "decryptedMessageService#73164160",
|
||||
DecryptedMessageMediaVideo23TypeID: "decryptedMessageMediaVideo23#524a415d",
|
||||
DecryptedMessageMediaAudioTypeID: "decryptedMessageMediaAudio#57e0a9cb",
|
||||
DecryptedMessageLayerTypeID: "decryptedMessageLayer#1be31789",
|
||||
SendMessageTypingActionTypeID: "sendMessageTypingAction#16bf744e",
|
||||
SendMessageCancelActionTypeID: "sendMessageCancelAction#fd5ec8f5",
|
||||
SendMessageRecordVideoActionTypeID: "sendMessageRecordVideoAction#a187d66f",
|
||||
SendMessageUploadVideoActionTypeID: "sendMessageUploadVideoAction#92042ff7",
|
||||
SendMessageRecordAudioActionTypeID: "sendMessageRecordAudioAction#d52f73f7",
|
||||
SendMessageUploadAudioActionTypeID: "sendMessageUploadAudioAction#e6ac8a6f",
|
||||
SendMessageUploadPhotoActionTypeID: "sendMessageUploadPhotoAction#990a3c1a",
|
||||
SendMessageUploadDocumentActionTypeID: "sendMessageUploadDocumentAction#8faee98e",
|
||||
SendMessageGeoLocationActionTypeID: "sendMessageGeoLocationAction#176f8ba1",
|
||||
SendMessageChooseContactActionTypeID: "sendMessageChooseContactAction#628cbc6f",
|
||||
DecryptedMessageActionResendTypeID: "decryptedMessageActionResend#511110b0",
|
||||
DecryptedMessageActionNotifyLayerTypeID: "decryptedMessageActionNotifyLayer#f3048883",
|
||||
DecryptedMessageActionTypingTypeID: "decryptedMessageActionTyping#ccb27641",
|
||||
DecryptedMessageActionRequestKeyTypeID: "decryptedMessageActionRequestKey#f3c9611b",
|
||||
DecryptedMessageActionAcceptKeyTypeID: "decryptedMessageActionAcceptKey#6fe1735b",
|
||||
DecryptedMessageActionAbortKeyTypeID: "decryptedMessageActionAbortKey#dd05ec6b",
|
||||
DecryptedMessageActionCommitKeyTypeID: "decryptedMessageActionCommitKey#ec2e0b9b",
|
||||
DecryptedMessageActionNoopTypeID: "decryptedMessageActionNoop#a82fdd63",
|
||||
DocumentAttributeImageSizeTypeID: "documentAttributeImageSize#6c37c15c",
|
||||
DocumentAttributeAnimatedTypeID: "documentAttributeAnimated#11b58939",
|
||||
DocumentAttributeSticker23TypeID: "documentAttributeSticker23#fb0a5727",
|
||||
DocumentAttributeVideo23TypeID: "documentAttributeVideo23#5910cccb",
|
||||
DocumentAttributeAudio23TypeID: "documentAttributeAudio23#51448e5",
|
||||
DocumentAttributeFilenameTypeID: "documentAttributeFilename#15590068",
|
||||
PhotoSizeEmptyTypeID: "photoSizeEmpty#e17e23c",
|
||||
PhotoSizeTypeID: "photoSize#77bfb61b",
|
||||
PhotoCachedSizeTypeID: "photoCachedSize#e9a734fa",
|
||||
FileLocationUnavailableTypeID: "fileLocationUnavailable#7c596b46",
|
||||
FileLocationTypeID: "fileLocation#53d69076",
|
||||
DecryptedMessageMediaExternalDocumentTypeID: "decryptedMessageMediaExternalDocument#fa95b0dd",
|
||||
DocumentAttributeAudio45TypeID: "documentAttributeAudio45#ded218e0",
|
||||
DecryptedMessage46TypeID: "decryptedMessage46#36b091de",
|
||||
DecryptedMessageMediaPhotoTypeID: "decryptedMessageMediaPhoto#f1fa8d78",
|
||||
DecryptedMessageMediaVideoTypeID: "decryptedMessageMediaVideo#970c8c0e",
|
||||
DecryptedMessageMediaDocument46TypeID: "decryptedMessageMediaDocument46#7afe8ae2",
|
||||
DocumentAttributeStickerTypeID: "documentAttributeSticker#3a556302",
|
||||
DocumentAttributeAudioTypeID: "documentAttributeAudio#9852f9c6",
|
||||
MessageEntityUnknownTypeID: "messageEntityUnknown#bb92ba95",
|
||||
MessageEntityMentionTypeID: "messageEntityMention#fa04579d",
|
||||
MessageEntityHashtagTypeID: "messageEntityHashtag#6f635b0d",
|
||||
MessageEntityBotCommandTypeID: "messageEntityBotCommand#6cef8ac7",
|
||||
MessageEntityURLTypeID: "messageEntityUrl#6ed02538",
|
||||
MessageEntityEmailTypeID: "messageEntityEmail#64e475c2",
|
||||
MessageEntityBoldTypeID: "messageEntityBold#bd610bc9",
|
||||
MessageEntityItalicTypeID: "messageEntityItalic#826f8b60",
|
||||
MessageEntityCodeTypeID: "messageEntityCode#28a20571",
|
||||
MessageEntityPreTypeID: "messageEntityPre#73924be0",
|
||||
MessageEntityTextURLTypeID: "messageEntityTextUrl#76a6d327",
|
||||
MessageEntityMentionNameTypeID: "messageEntityMentionName#352dca58",
|
||||
MessageEntityPhoneTypeID: "messageEntityPhone#9b69e34b",
|
||||
MessageEntityCashtagTypeID: "messageEntityCashtag#4c4e743f",
|
||||
MessageEntityBankCardTypeID: "messageEntityBankCard#761e6af4",
|
||||
InputStickerSetShortNameTypeID: "inputStickerSetShortName#861cc8a0",
|
||||
InputStickerSetEmptyTypeID: "inputStickerSetEmpty#ffb62b95",
|
||||
DecryptedMessageMediaVenueTypeID: "decryptedMessageMediaVenue#8a0df56f",
|
||||
DecryptedMessageMediaWebPageTypeID: "decryptedMessageMediaWebPage#e50511d8",
|
||||
SendMessageRecordRoundActionTypeID: "sendMessageRecordRoundAction#88f27fbc",
|
||||
SendMessageUploadRoundActionTypeID: "sendMessageUploadRoundAction#bb718624",
|
||||
DocumentAttributeVideoTypeID: "documentAttributeVideo#ef02ce6",
|
||||
DecryptedMessageTypeID: "decryptedMessage#91cc4674",
|
||||
MessageEntityUnderlineTypeID: "messageEntityUnderline#9c4e7e8b",
|
||||
MessageEntityStrikeTypeID: "messageEntityStrike#bf0693d4",
|
||||
MessageEntityBlockquoteTypeID: "messageEntityBlockquote#20df5d0",
|
||||
DecryptedMessageMediaDocumentTypeID: "decryptedMessageMediaDocument#6abd9782",
|
||||
MessageEntitySpoilerTypeID: "messageEntitySpoiler#32ca960f",
|
||||
MessageEntityCustomEmojiTypeID: "messageEntityCustomEmoji#c8cf05f8",
|
||||
TestDummyFunctionRequestTypeID: "test.dummyFunction#c8357709",
|
||||
}
|
||||
}
|
||||
|
||||
// NamesMap returns mapping from type names to TL type ids.
|
||||
func NamesMap() map[string]uint32 {
|
||||
return map[string]uint32{
|
||||
"int": IntTypeID,
|
||||
"long": LongTypeID,
|
||||
"double": DoubleTypeID,
|
||||
"string": StringTypeID,
|
||||
"bytes": BytesTypeID,
|
||||
"boolFalse": BoolFalseTypeID,
|
||||
"boolTrue": BoolTrueTypeID,
|
||||
"true": TrueTypeID,
|
||||
"decryptedMessage8": DecryptedMessage8TypeID,
|
||||
"decryptedMessageService8": DecryptedMessageService8TypeID,
|
||||
"decryptedMessageMediaEmpty": DecryptedMessageMediaEmptyTypeID,
|
||||
"decryptedMessageMediaPhoto8": DecryptedMessageMediaPhoto8TypeID,
|
||||
"decryptedMessageMediaVideo8": DecryptedMessageMediaVideo8TypeID,
|
||||
"decryptedMessageMediaGeoPoint": DecryptedMessageMediaGeoPointTypeID,
|
||||
"decryptedMessageMediaContact": DecryptedMessageMediaContactTypeID,
|
||||
"decryptedMessageActionSetMessageTTL": DecryptedMessageActionSetMessageTTLTypeID,
|
||||
"decryptedMessageMediaDocument8": DecryptedMessageMediaDocument8TypeID,
|
||||
"decryptedMessageMediaAudio8": DecryptedMessageMediaAudio8TypeID,
|
||||
"decryptedMessageActionReadMessages": DecryptedMessageActionReadMessagesTypeID,
|
||||
"decryptedMessageActionDeleteMessages": DecryptedMessageActionDeleteMessagesTypeID,
|
||||
"decryptedMessageActionScreenshotMessages": DecryptedMessageActionScreenshotMessagesTypeID,
|
||||
"decryptedMessageActionFlushHistory": DecryptedMessageActionFlushHistoryTypeID,
|
||||
"decryptedMessage23": DecryptedMessage23TypeID,
|
||||
"decryptedMessageService": DecryptedMessageServiceTypeID,
|
||||
"decryptedMessageMediaVideo23": DecryptedMessageMediaVideo23TypeID,
|
||||
"decryptedMessageMediaAudio": DecryptedMessageMediaAudioTypeID,
|
||||
"decryptedMessageLayer": DecryptedMessageLayerTypeID,
|
||||
"sendMessageTypingAction": SendMessageTypingActionTypeID,
|
||||
"sendMessageCancelAction": SendMessageCancelActionTypeID,
|
||||
"sendMessageRecordVideoAction": SendMessageRecordVideoActionTypeID,
|
||||
"sendMessageUploadVideoAction": SendMessageUploadVideoActionTypeID,
|
||||
"sendMessageRecordAudioAction": SendMessageRecordAudioActionTypeID,
|
||||
"sendMessageUploadAudioAction": SendMessageUploadAudioActionTypeID,
|
||||
"sendMessageUploadPhotoAction": SendMessageUploadPhotoActionTypeID,
|
||||
"sendMessageUploadDocumentAction": SendMessageUploadDocumentActionTypeID,
|
||||
"sendMessageGeoLocationAction": SendMessageGeoLocationActionTypeID,
|
||||
"sendMessageChooseContactAction": SendMessageChooseContactActionTypeID,
|
||||
"decryptedMessageActionResend": DecryptedMessageActionResendTypeID,
|
||||
"decryptedMessageActionNotifyLayer": DecryptedMessageActionNotifyLayerTypeID,
|
||||
"decryptedMessageActionTyping": DecryptedMessageActionTypingTypeID,
|
||||
"decryptedMessageActionRequestKey": DecryptedMessageActionRequestKeyTypeID,
|
||||
"decryptedMessageActionAcceptKey": DecryptedMessageActionAcceptKeyTypeID,
|
||||
"decryptedMessageActionAbortKey": DecryptedMessageActionAbortKeyTypeID,
|
||||
"decryptedMessageActionCommitKey": DecryptedMessageActionCommitKeyTypeID,
|
||||
"decryptedMessageActionNoop": DecryptedMessageActionNoopTypeID,
|
||||
"documentAttributeImageSize": DocumentAttributeImageSizeTypeID,
|
||||
"documentAttributeAnimated": DocumentAttributeAnimatedTypeID,
|
||||
"documentAttributeSticker23": DocumentAttributeSticker23TypeID,
|
||||
"documentAttributeVideo23": DocumentAttributeVideo23TypeID,
|
||||
"documentAttributeAudio23": DocumentAttributeAudio23TypeID,
|
||||
"documentAttributeFilename": DocumentAttributeFilenameTypeID,
|
||||
"photoSizeEmpty": PhotoSizeEmptyTypeID,
|
||||
"photoSize": PhotoSizeTypeID,
|
||||
"photoCachedSize": PhotoCachedSizeTypeID,
|
||||
"fileLocationUnavailable": FileLocationUnavailableTypeID,
|
||||
"fileLocation": FileLocationTypeID,
|
||||
"decryptedMessageMediaExternalDocument": DecryptedMessageMediaExternalDocumentTypeID,
|
||||
"documentAttributeAudio45": DocumentAttributeAudio45TypeID,
|
||||
"decryptedMessage46": DecryptedMessage46TypeID,
|
||||
"decryptedMessageMediaPhoto": DecryptedMessageMediaPhotoTypeID,
|
||||
"decryptedMessageMediaVideo": DecryptedMessageMediaVideoTypeID,
|
||||
"decryptedMessageMediaDocument46": DecryptedMessageMediaDocument46TypeID,
|
||||
"documentAttributeSticker": DocumentAttributeStickerTypeID,
|
||||
"documentAttributeAudio": DocumentAttributeAudioTypeID,
|
||||
"messageEntityUnknown": MessageEntityUnknownTypeID,
|
||||
"messageEntityMention": MessageEntityMentionTypeID,
|
||||
"messageEntityHashtag": MessageEntityHashtagTypeID,
|
||||
"messageEntityBotCommand": MessageEntityBotCommandTypeID,
|
||||
"messageEntityUrl": MessageEntityURLTypeID,
|
||||
"messageEntityEmail": MessageEntityEmailTypeID,
|
||||
"messageEntityBold": MessageEntityBoldTypeID,
|
||||
"messageEntityItalic": MessageEntityItalicTypeID,
|
||||
"messageEntityCode": MessageEntityCodeTypeID,
|
||||
"messageEntityPre": MessageEntityPreTypeID,
|
||||
"messageEntityTextUrl": MessageEntityTextURLTypeID,
|
||||
"messageEntityMentionName": MessageEntityMentionNameTypeID,
|
||||
"messageEntityPhone": MessageEntityPhoneTypeID,
|
||||
"messageEntityCashtag": MessageEntityCashtagTypeID,
|
||||
"messageEntityBankCard": MessageEntityBankCardTypeID,
|
||||
"inputStickerSetShortName": InputStickerSetShortNameTypeID,
|
||||
"inputStickerSetEmpty": InputStickerSetEmptyTypeID,
|
||||
"decryptedMessageMediaVenue": DecryptedMessageMediaVenueTypeID,
|
||||
"decryptedMessageMediaWebPage": DecryptedMessageMediaWebPageTypeID,
|
||||
"sendMessageRecordRoundAction": SendMessageRecordRoundActionTypeID,
|
||||
"sendMessageUploadRoundAction": SendMessageUploadRoundActionTypeID,
|
||||
"documentAttributeVideo": DocumentAttributeVideoTypeID,
|
||||
"decryptedMessage": DecryptedMessageTypeID,
|
||||
"messageEntityUnderline": MessageEntityUnderlineTypeID,
|
||||
"messageEntityStrike": MessageEntityStrikeTypeID,
|
||||
"messageEntityBlockquote": MessageEntityBlockquoteTypeID,
|
||||
"decryptedMessageMediaDocument": DecryptedMessageMediaDocumentTypeID,
|
||||
"messageEntitySpoiler": MessageEntitySpoilerTypeID,
|
||||
"messageEntityCustomEmoji": MessageEntityCustomEmojiTypeID,
|
||||
"test.dummyFunction": TestDummyFunctionRequestTypeID,
|
||||
}
|
||||
}
|
||||
|
||||
// TypesConstructorMap maps type ids to constructors.
|
||||
func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
return map[uint32]func() bin.Object{
|
||||
IntTypeID: func() bin.Object { return &Int{} },
|
||||
LongTypeID: func() bin.Object { return &Long{} },
|
||||
DoubleTypeID: func() bin.Object { return &Double{} },
|
||||
StringTypeID: func() bin.Object { return &String{} },
|
||||
BytesTypeID: func() bin.Object { return &Bytes{} },
|
||||
BoolFalseTypeID: func() bin.Object { return &BoolFalse{} },
|
||||
BoolTrueTypeID: func() bin.Object { return &BoolTrue{} },
|
||||
TrueTypeID: func() bin.Object { return &True{} },
|
||||
DecryptedMessage8TypeID: func() bin.Object { return &DecryptedMessage8{} },
|
||||
DecryptedMessageService8TypeID: func() bin.Object { return &DecryptedMessageService8{} },
|
||||
DecryptedMessageMediaEmptyTypeID: func() bin.Object { return &DecryptedMessageMediaEmpty{} },
|
||||
DecryptedMessageMediaPhoto8TypeID: func() bin.Object { return &DecryptedMessageMediaPhoto8{} },
|
||||
DecryptedMessageMediaVideo8TypeID: func() bin.Object { return &DecryptedMessageMediaVideo8{} },
|
||||
DecryptedMessageMediaGeoPointTypeID: func() bin.Object { return &DecryptedMessageMediaGeoPoint{} },
|
||||
DecryptedMessageMediaContactTypeID: func() bin.Object { return &DecryptedMessageMediaContact{} },
|
||||
DecryptedMessageActionSetMessageTTLTypeID: func() bin.Object { return &DecryptedMessageActionSetMessageTTL{} },
|
||||
DecryptedMessageMediaDocument8TypeID: func() bin.Object { return &DecryptedMessageMediaDocument8{} },
|
||||
DecryptedMessageMediaAudio8TypeID: func() bin.Object { return &DecryptedMessageMediaAudio8{} },
|
||||
DecryptedMessageActionReadMessagesTypeID: func() bin.Object { return &DecryptedMessageActionReadMessages{} },
|
||||
DecryptedMessageActionDeleteMessagesTypeID: func() bin.Object { return &DecryptedMessageActionDeleteMessages{} },
|
||||
DecryptedMessageActionScreenshotMessagesTypeID: func() bin.Object { return &DecryptedMessageActionScreenshotMessages{} },
|
||||
DecryptedMessageActionFlushHistoryTypeID: func() bin.Object { return &DecryptedMessageActionFlushHistory{} },
|
||||
DecryptedMessage23TypeID: func() bin.Object { return &DecryptedMessage23{} },
|
||||
DecryptedMessageServiceTypeID: func() bin.Object { return &DecryptedMessageService{} },
|
||||
DecryptedMessageMediaVideo23TypeID: func() bin.Object { return &DecryptedMessageMediaVideo23{} },
|
||||
DecryptedMessageMediaAudioTypeID: func() bin.Object { return &DecryptedMessageMediaAudio{} },
|
||||
DecryptedMessageLayerTypeID: func() bin.Object { return &DecryptedMessageLayer{} },
|
||||
SendMessageTypingActionTypeID: func() bin.Object { return &SendMessageTypingAction{} },
|
||||
SendMessageCancelActionTypeID: func() bin.Object { return &SendMessageCancelAction{} },
|
||||
SendMessageRecordVideoActionTypeID: func() bin.Object { return &SendMessageRecordVideoAction{} },
|
||||
SendMessageUploadVideoActionTypeID: func() bin.Object { return &SendMessageUploadVideoAction{} },
|
||||
SendMessageRecordAudioActionTypeID: func() bin.Object { return &SendMessageRecordAudioAction{} },
|
||||
SendMessageUploadAudioActionTypeID: func() bin.Object { return &SendMessageUploadAudioAction{} },
|
||||
SendMessageUploadPhotoActionTypeID: func() bin.Object { return &SendMessageUploadPhotoAction{} },
|
||||
SendMessageUploadDocumentActionTypeID: func() bin.Object { return &SendMessageUploadDocumentAction{} },
|
||||
SendMessageGeoLocationActionTypeID: func() bin.Object { return &SendMessageGeoLocationAction{} },
|
||||
SendMessageChooseContactActionTypeID: func() bin.Object { return &SendMessageChooseContactAction{} },
|
||||
DecryptedMessageActionResendTypeID: func() bin.Object { return &DecryptedMessageActionResend{} },
|
||||
DecryptedMessageActionNotifyLayerTypeID: func() bin.Object { return &DecryptedMessageActionNotifyLayer{} },
|
||||
DecryptedMessageActionTypingTypeID: func() bin.Object { return &DecryptedMessageActionTyping{} },
|
||||
DecryptedMessageActionRequestKeyTypeID: func() bin.Object { return &DecryptedMessageActionRequestKey{} },
|
||||
DecryptedMessageActionAcceptKeyTypeID: func() bin.Object { return &DecryptedMessageActionAcceptKey{} },
|
||||
DecryptedMessageActionAbortKeyTypeID: func() bin.Object { return &DecryptedMessageActionAbortKey{} },
|
||||
DecryptedMessageActionCommitKeyTypeID: func() bin.Object { return &DecryptedMessageActionCommitKey{} },
|
||||
DecryptedMessageActionNoopTypeID: func() bin.Object { return &DecryptedMessageActionNoop{} },
|
||||
DocumentAttributeImageSizeTypeID: func() bin.Object { return &DocumentAttributeImageSize{} },
|
||||
DocumentAttributeAnimatedTypeID: func() bin.Object { return &DocumentAttributeAnimated{} },
|
||||
DocumentAttributeSticker23TypeID: func() bin.Object { return &DocumentAttributeSticker23{} },
|
||||
DocumentAttributeVideo23TypeID: func() bin.Object { return &DocumentAttributeVideo23{} },
|
||||
DocumentAttributeAudio23TypeID: func() bin.Object { return &DocumentAttributeAudio23{} },
|
||||
DocumentAttributeFilenameTypeID: func() bin.Object { return &DocumentAttributeFilename{} },
|
||||
PhotoSizeEmptyTypeID: func() bin.Object { return &PhotoSizeEmpty{} },
|
||||
PhotoSizeTypeID: func() bin.Object { return &PhotoSize{} },
|
||||
PhotoCachedSizeTypeID: func() bin.Object { return &PhotoCachedSize{} },
|
||||
FileLocationUnavailableTypeID: func() bin.Object { return &FileLocationUnavailable{} },
|
||||
FileLocationTypeID: func() bin.Object { return &FileLocation{} },
|
||||
DecryptedMessageMediaExternalDocumentTypeID: func() bin.Object { return &DecryptedMessageMediaExternalDocument{} },
|
||||
DocumentAttributeAudio45TypeID: func() bin.Object { return &DocumentAttributeAudio45{} },
|
||||
DecryptedMessage46TypeID: func() bin.Object { return &DecryptedMessage46{} },
|
||||
DecryptedMessageMediaPhotoTypeID: func() bin.Object { return &DecryptedMessageMediaPhoto{} },
|
||||
DecryptedMessageMediaVideoTypeID: func() bin.Object { return &DecryptedMessageMediaVideo{} },
|
||||
DecryptedMessageMediaDocument46TypeID: func() bin.Object { return &DecryptedMessageMediaDocument46{} },
|
||||
DocumentAttributeStickerTypeID: func() bin.Object { return &DocumentAttributeSticker{} },
|
||||
DocumentAttributeAudioTypeID: func() bin.Object { return &DocumentAttributeAudio{} },
|
||||
MessageEntityUnknownTypeID: func() bin.Object { return &MessageEntityUnknown{} },
|
||||
MessageEntityMentionTypeID: func() bin.Object { return &MessageEntityMention{} },
|
||||
MessageEntityHashtagTypeID: func() bin.Object { return &MessageEntityHashtag{} },
|
||||
MessageEntityBotCommandTypeID: func() bin.Object { return &MessageEntityBotCommand{} },
|
||||
MessageEntityURLTypeID: func() bin.Object { return &MessageEntityURL{} },
|
||||
MessageEntityEmailTypeID: func() bin.Object { return &MessageEntityEmail{} },
|
||||
MessageEntityBoldTypeID: func() bin.Object { return &MessageEntityBold{} },
|
||||
MessageEntityItalicTypeID: func() bin.Object { return &MessageEntityItalic{} },
|
||||
MessageEntityCodeTypeID: func() bin.Object { return &MessageEntityCode{} },
|
||||
MessageEntityPreTypeID: func() bin.Object { return &MessageEntityPre{} },
|
||||
MessageEntityTextURLTypeID: func() bin.Object { return &MessageEntityTextURL{} },
|
||||
MessageEntityMentionNameTypeID: func() bin.Object { return &MessageEntityMentionName{} },
|
||||
MessageEntityPhoneTypeID: func() bin.Object { return &MessageEntityPhone{} },
|
||||
MessageEntityCashtagTypeID: func() bin.Object { return &MessageEntityCashtag{} },
|
||||
MessageEntityBankCardTypeID: func() bin.Object { return &MessageEntityBankCard{} },
|
||||
InputStickerSetShortNameTypeID: func() bin.Object { return &InputStickerSetShortName{} },
|
||||
InputStickerSetEmptyTypeID: func() bin.Object { return &InputStickerSetEmpty{} },
|
||||
DecryptedMessageMediaVenueTypeID: func() bin.Object { return &DecryptedMessageMediaVenue{} },
|
||||
DecryptedMessageMediaWebPageTypeID: func() bin.Object { return &DecryptedMessageMediaWebPage{} },
|
||||
SendMessageRecordRoundActionTypeID: func() bin.Object { return &SendMessageRecordRoundAction{} },
|
||||
SendMessageUploadRoundActionTypeID: func() bin.Object { return &SendMessageUploadRoundAction{} },
|
||||
DocumentAttributeVideoTypeID: func() bin.Object { return &DocumentAttributeVideo{} },
|
||||
DecryptedMessageTypeID: func() bin.Object { return &DecryptedMessage{} },
|
||||
MessageEntityUnderlineTypeID: func() bin.Object { return &MessageEntityUnderline{} },
|
||||
MessageEntityStrikeTypeID: func() bin.Object { return &MessageEntityStrike{} },
|
||||
MessageEntityBlockquoteTypeID: func() bin.Object { return &MessageEntityBlockquote{} },
|
||||
DecryptedMessageMediaDocumentTypeID: func() bin.Object { return &DecryptedMessageMediaDocument{} },
|
||||
MessageEntitySpoilerTypeID: func() bin.Object { return &MessageEntitySpoiler{} },
|
||||
MessageEntityCustomEmojiTypeID: func() bin.Object { return &MessageEntityCustomEmoji{} },
|
||||
TestDummyFunctionRequestTypeID: func() bin.Object { return &TestDummyFunctionRequest{} },
|
||||
}
|
||||
}
|
||||
|
||||
// ClassConstructorsMap maps class schema name to constructors type ids.
|
||||
func ClassConstructorsMap() map[string][]uint32 {
|
||||
return map[string][]uint32{
|
||||
BoolClassName: {
|
||||
BoolFalseTypeID,
|
||||
BoolTrueTypeID,
|
||||
},
|
||||
DecryptedMessageActionClassName: {
|
||||
DecryptedMessageActionSetMessageTTLTypeID,
|
||||
DecryptedMessageActionReadMessagesTypeID,
|
||||
DecryptedMessageActionDeleteMessagesTypeID,
|
||||
DecryptedMessageActionScreenshotMessagesTypeID,
|
||||
DecryptedMessageActionFlushHistoryTypeID,
|
||||
DecryptedMessageActionResendTypeID,
|
||||
DecryptedMessageActionNotifyLayerTypeID,
|
||||
DecryptedMessageActionTypingTypeID,
|
||||
DecryptedMessageActionRequestKeyTypeID,
|
||||
DecryptedMessageActionAcceptKeyTypeID,
|
||||
DecryptedMessageActionAbortKeyTypeID,
|
||||
DecryptedMessageActionCommitKeyTypeID,
|
||||
DecryptedMessageActionNoopTypeID,
|
||||
},
|
||||
DecryptedMessageClassName: {
|
||||
DecryptedMessage8TypeID,
|
||||
DecryptedMessageService8TypeID,
|
||||
DecryptedMessage23TypeID,
|
||||
DecryptedMessageServiceTypeID,
|
||||
DecryptedMessage46TypeID,
|
||||
DecryptedMessageTypeID,
|
||||
},
|
||||
DecryptedMessageMediaClassName: {
|
||||
DecryptedMessageMediaEmptyTypeID,
|
||||
DecryptedMessageMediaPhoto8TypeID,
|
||||
DecryptedMessageMediaVideo8TypeID,
|
||||
DecryptedMessageMediaGeoPointTypeID,
|
||||
DecryptedMessageMediaContactTypeID,
|
||||
DecryptedMessageMediaDocument8TypeID,
|
||||
DecryptedMessageMediaAudio8TypeID,
|
||||
DecryptedMessageMediaVideo23TypeID,
|
||||
DecryptedMessageMediaAudioTypeID,
|
||||
DecryptedMessageMediaExternalDocumentTypeID,
|
||||
DecryptedMessageMediaPhotoTypeID,
|
||||
DecryptedMessageMediaVideoTypeID,
|
||||
DecryptedMessageMediaDocument46TypeID,
|
||||
DecryptedMessageMediaVenueTypeID,
|
||||
DecryptedMessageMediaWebPageTypeID,
|
||||
DecryptedMessageMediaDocumentTypeID,
|
||||
},
|
||||
DocumentAttributeClassName: {
|
||||
DocumentAttributeImageSizeTypeID,
|
||||
DocumentAttributeAnimatedTypeID,
|
||||
DocumentAttributeSticker23TypeID,
|
||||
DocumentAttributeVideo23TypeID,
|
||||
DocumentAttributeAudio23TypeID,
|
||||
DocumentAttributeFilenameTypeID,
|
||||
DocumentAttributeAudio45TypeID,
|
||||
DocumentAttributeStickerTypeID,
|
||||
DocumentAttributeAudioTypeID,
|
||||
DocumentAttributeVideoTypeID,
|
||||
},
|
||||
FileLocationClassName: {
|
||||
FileLocationUnavailableTypeID,
|
||||
FileLocationTypeID,
|
||||
},
|
||||
InputStickerSetClassName: {
|
||||
InputStickerSetShortNameTypeID,
|
||||
InputStickerSetEmptyTypeID,
|
||||
},
|
||||
MessageEntityClassName: {
|
||||
MessageEntityUnknownTypeID,
|
||||
MessageEntityMentionTypeID,
|
||||
MessageEntityHashtagTypeID,
|
||||
MessageEntityBotCommandTypeID,
|
||||
MessageEntityURLTypeID,
|
||||
MessageEntityEmailTypeID,
|
||||
MessageEntityBoldTypeID,
|
||||
MessageEntityItalicTypeID,
|
||||
MessageEntityCodeTypeID,
|
||||
MessageEntityPreTypeID,
|
||||
MessageEntityTextURLTypeID,
|
||||
MessageEntityMentionNameTypeID,
|
||||
MessageEntityPhoneTypeID,
|
||||
MessageEntityCashtagTypeID,
|
||||
MessageEntityBankCardTypeID,
|
||||
MessageEntityUnderlineTypeID,
|
||||
MessageEntityStrikeTypeID,
|
||||
MessageEntityBlockquoteTypeID,
|
||||
MessageEntitySpoilerTypeID,
|
||||
MessageEntityCustomEmojiTypeID,
|
||||
},
|
||||
PhotoSizeClassName: {
|
||||
PhotoSizeEmptyTypeID,
|
||||
PhotoSizeTypeID,
|
||||
PhotoCachedSizeTypeID,
|
||||
},
|
||||
SendMessageActionClassName: {
|
||||
SendMessageTypingActionTypeID,
|
||||
SendMessageCancelActionTypeID,
|
||||
SendMessageRecordVideoActionTypeID,
|
||||
SendMessageUploadVideoActionTypeID,
|
||||
SendMessageRecordAudioActionTypeID,
|
||||
SendMessageUploadAudioActionTypeID,
|
||||
SendMessageUploadPhotoActionTypeID,
|
||||
SendMessageUploadDocumentActionTypeID,
|
||||
SendMessageGeoLocationActionTypeID,
|
||||
SendMessageChooseContactActionTypeID,
|
||||
SendMessageRecordRoundActionTypeID,
|
||||
SendMessageUploadRoundActionTypeID,
|
||||
},
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,128 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// String represents TL type `string#b5286e24`.
|
||||
//
|
||||
// See https://core.telegram.org/constructor/string for reference.
|
||||
type String struct {
|
||||
}
|
||||
|
||||
// StringTypeID is TL type id of String.
|
||||
const StringTypeID = 0xb5286e24
|
||||
|
||||
// Ensuring interfaces in compile-time for String.
|
||||
var (
|
||||
_ bin.Encoder = &String{}
|
||||
_ bin.Decoder = &String{}
|
||||
_ bin.BareEncoder = &String{}
|
||||
_ bin.BareDecoder = &String{}
|
||||
)
|
||||
|
||||
func (s *String) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *String) String() string {
|
||||
if s == nil {
|
||||
return "String(nil)"
|
||||
}
|
||||
type Alias String
|
||||
return fmt.Sprintf("String%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*String) TypeID() uint32 {
|
||||
return StringTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*String) TypeName() string {
|
||||
return "string"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *String) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "string",
|
||||
ID: StringTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *String) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode string#b5286e24 as nil")
|
||||
}
|
||||
b.PutID(StringTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *String) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode string#b5286e24 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *String) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode string#b5286e24 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(StringTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode string#b5286e24: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *String) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode string#b5286e24 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// TestDummyFunctionRequest represents TL type `test.dummyFunction#c8357709`.
|
||||
//
|
||||
// See https://core.telegram.org/method/test.dummyFunction for reference.
|
||||
type TestDummyFunctionRequest struct {
|
||||
}
|
||||
|
||||
// TestDummyFunctionRequestTypeID is TL type id of TestDummyFunctionRequest.
|
||||
const TestDummyFunctionRequestTypeID = 0xc8357709
|
||||
|
||||
// Ensuring interfaces in compile-time for TestDummyFunctionRequest.
|
||||
var (
|
||||
_ bin.Encoder = &TestDummyFunctionRequest{}
|
||||
_ bin.Decoder = &TestDummyFunctionRequest{}
|
||||
_ bin.BareEncoder = &TestDummyFunctionRequest{}
|
||||
_ bin.BareDecoder = &TestDummyFunctionRequest{}
|
||||
)
|
||||
|
||||
func (d *TestDummyFunctionRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *TestDummyFunctionRequest) String() string {
|
||||
if d == nil {
|
||||
return "TestDummyFunctionRequest(nil)"
|
||||
}
|
||||
type Alias TestDummyFunctionRequest
|
||||
return fmt.Sprintf("TestDummyFunctionRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*TestDummyFunctionRequest) TypeID() uint32 {
|
||||
return TestDummyFunctionRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*TestDummyFunctionRequest) TypeName() string {
|
||||
return "test.dummyFunction"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *TestDummyFunctionRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "test.dummyFunction",
|
||||
ID: TestDummyFunctionRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *TestDummyFunctionRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode test.dummyFunction#c8357709 as nil")
|
||||
}
|
||||
b.PutID(TestDummyFunctionRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *TestDummyFunctionRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode test.dummyFunction#c8357709 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *TestDummyFunctionRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode test.dummyFunction#c8357709 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(TestDummyFunctionRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode test.dummyFunction#c8357709: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *TestDummyFunctionRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode test.dummyFunction#c8357709 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TestDummyFunction invokes method test.dummyFunction#c8357709 returning error if any.
|
||||
//
|
||||
// See https://core.telegram.org/method/test.dummyFunction for reference.
|
||||
func (c *Client) TestDummyFunction(ctx context.Context) (bool, error) {
|
||||
var result BoolBox
|
||||
|
||||
request := &TestDummyFunctionRequest{}
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return false, err
|
||||
}
|
||||
_, ok := result.Bool.(*BoolTrue)
|
||||
return ok, nil
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package e2e
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// True represents TL type `true#3fedd339`.
|
||||
// See predefined identifiers¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/mtproto/TL-formal#predefined-identifiers
|
||||
//
|
||||
// See https://core.telegram.org/constructor/true for reference.
|
||||
type True struct {
|
||||
}
|
||||
|
||||
// TrueTypeID is TL type id of True.
|
||||
const TrueTypeID = 0x3fedd339
|
||||
|
||||
// Ensuring interfaces in compile-time for True.
|
||||
var (
|
||||
_ bin.Encoder = &True{}
|
||||
_ bin.Decoder = &True{}
|
||||
_ bin.BareEncoder = &True{}
|
||||
_ bin.BareDecoder = &True{}
|
||||
)
|
||||
|
||||
func (t *True) Zero() bool {
|
||||
if t == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (t *True) String() string {
|
||||
if t == nil {
|
||||
return "True(nil)"
|
||||
}
|
||||
type Alias True
|
||||
return fmt.Sprintf("True%+v", Alias(*t))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*True) TypeID() uint32 {
|
||||
return TrueTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*True) TypeName() string {
|
||||
return "true"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (t *True) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "true",
|
||||
ID: TrueTypeID,
|
||||
}
|
||||
if t == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (t *True) Encode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode true#3fedd339 as nil")
|
||||
}
|
||||
b.PutID(TrueTypeID)
|
||||
return t.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (t *True) EncodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode true#3fedd339 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (t *True) Decode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode true#3fedd339 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(TrueTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode true#3fedd339: %w", err)
|
||||
}
|
||||
return t.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (t *True) DecodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode true#3fedd339 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user