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,154 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package td
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// SMS represents TL type `sms#ed8bebfe`.
|
||||
//
|
||||
// See https://localhost:80/doc/constructor/sms for reference.
|
||||
type SMS struct {
|
||||
// Text field of SMS.
|
||||
Text string
|
||||
}
|
||||
|
||||
// SMSTypeID is TL type id of SMS.
|
||||
const SMSTypeID = 0xed8bebfe
|
||||
|
||||
// Ensuring interfaces in compile-time for SMS.
|
||||
var (
|
||||
_ bin.Encoder = &SMS{}
|
||||
_ bin.Decoder = &SMS{}
|
||||
_ bin.BareEncoder = &SMS{}
|
||||
_ bin.BareDecoder = &SMS{}
|
||||
)
|
||||
|
||||
func (s *SMS) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Text == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *SMS) String() string {
|
||||
if s == nil {
|
||||
return "SMS(nil)"
|
||||
}
|
||||
type Alias SMS
|
||||
return fmt.Sprintf("SMS%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*SMS) TypeID() uint32 {
|
||||
return SMSTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*SMS) TypeName() string {
|
||||
return "sms"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *SMS) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "sms",
|
||||
ID: SMSTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Text",
|
||||
SchemaName: "text",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *SMS) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode sms#ed8bebfe as nil")
|
||||
}
|
||||
b.PutID(SMSTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *SMS) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode sms#ed8bebfe as nil")
|
||||
}
|
||||
b.PutString(s.Text)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *SMS) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode sms#ed8bebfe to nil")
|
||||
}
|
||||
if err := b.ConsumeID(SMSTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode sms#ed8bebfe: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *SMS) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode sms#ed8bebfe to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode sms#ed8bebfe: field text: %w", err)
|
||||
}
|
||||
s.Text = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetText returns value of Text field.
|
||||
func (s *SMS) GetText() (value string) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Text
|
||||
}
|
||||
Reference in New Issue
Block a user