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:
Adam Van Ymeren
2025-06-27 20:03:37 -07:00
committed by GitHub
parent 0952df0244
commit 7a04f298d2
19264 changed files with 1539697 additions and 84 deletions
+193
View File
@@ -0,0 +1,193 @@
// Code generated by gotdgen, DO NOT EDIT.
package tdapi
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
_ = tdjson.Encoder{}
)
// TestString represents TL type `testString#fe56688c`.
type TestString struct {
// String
Value string
}
// TestStringTypeID is TL type id of TestString.
const TestStringTypeID = 0xfe56688c
// Ensuring interfaces in compile-time for TestString.
var (
_ bin.Encoder = &TestString{}
_ bin.Decoder = &TestString{}
_ bin.BareEncoder = &TestString{}
_ bin.BareDecoder = &TestString{}
)
func (t *TestString) Zero() bool {
if t == nil {
return true
}
if !(t.Value == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (t *TestString) String() string {
if t == nil {
return "TestString(nil)"
}
type Alias TestString
return fmt.Sprintf("TestString%+v", Alias(*t))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*TestString) TypeID() uint32 {
return TestStringTypeID
}
// TypeName returns name of type in TL schema.
func (*TestString) TypeName() string {
return "testString"
}
// TypeInfo returns info about TL type.
func (t *TestString) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "testString",
ID: TestStringTypeID,
}
if t == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Value",
SchemaName: "value",
},
}
return typ
}
// Encode implements bin.Encoder.
func (t *TestString) Encode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode testString#fe56688c as nil")
}
b.PutID(TestStringTypeID)
return t.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (t *TestString) EncodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't encode testString#fe56688c as nil")
}
b.PutString(t.Value)
return nil
}
// Decode implements bin.Decoder.
func (t *TestString) Decode(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode testString#fe56688c to nil")
}
if err := b.ConsumeID(TestStringTypeID); err != nil {
return fmt.Errorf("unable to decode testString#fe56688c: %w", err)
}
return t.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (t *TestString) DecodeBare(b *bin.Buffer) error {
if t == nil {
return fmt.Errorf("can't decode testString#fe56688c to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode testString#fe56688c: field value: %w", err)
}
t.Value = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (t *TestString) EncodeTDLibJSON(b tdjson.Encoder) error {
if t == nil {
return fmt.Errorf("can't encode testString#fe56688c as nil")
}
b.ObjStart()
b.PutID("testString")
b.Comma()
b.FieldStart("value")
b.PutString(t.Value)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (t *TestString) DecodeTDLibJSON(b tdjson.Decoder) error {
if t == nil {
return fmt.Errorf("can't decode testString#fe56688c to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("testString"); err != nil {
return fmt.Errorf("unable to decode testString#fe56688c: %w", err)
}
case "value":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode testString#fe56688c: field value: %w", err)
}
t.Value = value
default:
return b.Skip()
}
return nil
})
}
// GetValue returns value of Value field.
func (t *TestString) GetValue() (value string) {
if t == nil {
return
}
return t.Value
}