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,261 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BusinessStartPage represents TL type `businessStartPage#9fa2f7cf`.
|
||||
type BusinessStartPage struct {
|
||||
// Title text of the start page
|
||||
Title string
|
||||
// Message text of the start page
|
||||
Message string
|
||||
// Greeting sticker of the start page; may be null if none
|
||||
Sticker Sticker
|
||||
}
|
||||
|
||||
// BusinessStartPageTypeID is TL type id of BusinessStartPage.
|
||||
const BusinessStartPageTypeID = 0x9fa2f7cf
|
||||
|
||||
// Ensuring interfaces in compile-time for BusinessStartPage.
|
||||
var (
|
||||
_ bin.Encoder = &BusinessStartPage{}
|
||||
_ bin.Decoder = &BusinessStartPage{}
|
||||
_ bin.BareEncoder = &BusinessStartPage{}
|
||||
_ bin.BareDecoder = &BusinessStartPage{}
|
||||
)
|
||||
|
||||
func (b *BusinessStartPage) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
if !(b.Title == "") {
|
||||
return false
|
||||
}
|
||||
if !(b.Message == "") {
|
||||
return false
|
||||
}
|
||||
if !(b.Sticker.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BusinessStartPage) String() string {
|
||||
if b == nil {
|
||||
return "BusinessStartPage(nil)"
|
||||
}
|
||||
type Alias BusinessStartPage
|
||||
return fmt.Sprintf("BusinessStartPage%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BusinessStartPage) TypeID() uint32 {
|
||||
return BusinessStartPageTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BusinessStartPage) TypeName() string {
|
||||
return "businessStartPage"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BusinessStartPage) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "businessStartPage",
|
||||
ID: BusinessStartPageTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Title",
|
||||
SchemaName: "title",
|
||||
},
|
||||
{
|
||||
Name: "Message",
|
||||
SchemaName: "message",
|
||||
},
|
||||
{
|
||||
Name: "Sticker",
|
||||
SchemaName: "sticker",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BusinessStartPage) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode businessStartPage#9fa2f7cf as nil")
|
||||
}
|
||||
buf.PutID(BusinessStartPageTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BusinessStartPage) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode businessStartPage#9fa2f7cf as nil")
|
||||
}
|
||||
buf.PutString(b.Title)
|
||||
buf.PutString(b.Message)
|
||||
if err := b.Sticker.Encode(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode businessStartPage#9fa2f7cf: field sticker: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BusinessStartPage) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode businessStartPage#9fa2f7cf to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BusinessStartPageTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BusinessStartPage) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode businessStartPage#9fa2f7cf to nil")
|
||||
}
|
||||
{
|
||||
value, err := buf.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field title: %w", err)
|
||||
}
|
||||
b.Title = value
|
||||
}
|
||||
{
|
||||
value, err := buf.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field message: %w", err)
|
||||
}
|
||||
b.Message = value
|
||||
}
|
||||
{
|
||||
if err := b.Sticker.Decode(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field sticker: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (b *BusinessStartPage) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode businessStartPage#9fa2f7cf as nil")
|
||||
}
|
||||
buf.ObjStart()
|
||||
buf.PutID("businessStartPage")
|
||||
buf.Comma()
|
||||
buf.FieldStart("title")
|
||||
buf.PutString(b.Title)
|
||||
buf.Comma()
|
||||
buf.FieldStart("message")
|
||||
buf.PutString(b.Message)
|
||||
buf.Comma()
|
||||
buf.FieldStart("sticker")
|
||||
if err := b.Sticker.EncodeTDLibJSON(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode businessStartPage#9fa2f7cf: field sticker: %w", err)
|
||||
}
|
||||
buf.Comma()
|
||||
buf.StripComma()
|
||||
buf.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (b *BusinessStartPage) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode businessStartPage#9fa2f7cf to nil")
|
||||
}
|
||||
|
||||
return buf.Obj(func(buf tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := buf.ConsumeID("businessStartPage"); err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: %w", err)
|
||||
}
|
||||
case "title":
|
||||
value, err := buf.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field title: %w", err)
|
||||
}
|
||||
b.Title = value
|
||||
case "message":
|
||||
value, err := buf.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field message: %w", err)
|
||||
}
|
||||
b.Message = value
|
||||
case "sticker":
|
||||
if err := b.Sticker.DecodeTDLibJSON(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field sticker: %w", err)
|
||||
}
|
||||
default:
|
||||
return buf.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetTitle returns value of Title field.
|
||||
func (b *BusinessStartPage) GetTitle() (value string) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Title
|
||||
}
|
||||
|
||||
// GetMessage returns value of Message field.
|
||||
func (b *BusinessStartPage) GetMessage() (value string) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Message
|
||||
}
|
||||
|
||||
// GetSticker returns value of Sticker field.
|
||||
func (b *BusinessStartPage) GetSticker() (value Sticker) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Sticker
|
||||
}
|
||||
Reference in New Issue
Block a user