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,221 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// VideoChatStreams represents TL type `videoChatStreams#58e70d9b`.
|
||||
type VideoChatStreams struct {
|
||||
// A list of video chat streams
|
||||
Streams []VideoChatStream
|
||||
}
|
||||
|
||||
// VideoChatStreamsTypeID is TL type id of VideoChatStreams.
|
||||
const VideoChatStreamsTypeID = 0x58e70d9b
|
||||
|
||||
// Ensuring interfaces in compile-time for VideoChatStreams.
|
||||
var (
|
||||
_ bin.Encoder = &VideoChatStreams{}
|
||||
_ bin.Decoder = &VideoChatStreams{}
|
||||
_ bin.BareEncoder = &VideoChatStreams{}
|
||||
_ bin.BareDecoder = &VideoChatStreams{}
|
||||
)
|
||||
|
||||
func (v *VideoChatStreams) Zero() bool {
|
||||
if v == nil {
|
||||
return true
|
||||
}
|
||||
if !(v.Streams == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (v *VideoChatStreams) String() string {
|
||||
if v == nil {
|
||||
return "VideoChatStreams(nil)"
|
||||
}
|
||||
type Alias VideoChatStreams
|
||||
return fmt.Sprintf("VideoChatStreams%+v", Alias(*v))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*VideoChatStreams) TypeID() uint32 {
|
||||
return VideoChatStreamsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*VideoChatStreams) TypeName() string {
|
||||
return "videoChatStreams"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (v *VideoChatStreams) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "videoChatStreams",
|
||||
ID: VideoChatStreamsTypeID,
|
||||
}
|
||||
if v == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Streams",
|
||||
SchemaName: "streams",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (v *VideoChatStreams) Encode(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't encode videoChatStreams#58e70d9b as nil")
|
||||
}
|
||||
b.PutID(VideoChatStreamsTypeID)
|
||||
return v.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (v *VideoChatStreams) EncodeBare(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't encode videoChatStreams#58e70d9b as nil")
|
||||
}
|
||||
b.PutInt(len(v.Streams))
|
||||
for idx, v := range v.Streams {
|
||||
if err := v.EncodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bare videoChatStreams#58e70d9b: field streams element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (v *VideoChatStreams) Decode(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't decode videoChatStreams#58e70d9b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(VideoChatStreamsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode videoChatStreams#58e70d9b: %w", err)
|
||||
}
|
||||
return v.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (v *VideoChatStreams) DecodeBare(b *bin.Buffer) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't decode videoChatStreams#58e70d9b to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode videoChatStreams#58e70d9b: field streams: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
v.Streams = make([]VideoChatStream, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value VideoChatStream
|
||||
if err := value.DecodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to decode bare videoChatStreams#58e70d9b: field streams: %w", err)
|
||||
}
|
||||
v.Streams = append(v.Streams, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (v *VideoChatStreams) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't encode videoChatStreams#58e70d9b as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("videoChatStreams")
|
||||
b.Comma()
|
||||
b.FieldStart("streams")
|
||||
b.ArrStart()
|
||||
for idx, v := range v.Streams {
|
||||
if err := v.EncodeTDLibJSON(b); err != nil {
|
||||
return fmt.Errorf("unable to encode videoChatStreams#58e70d9b: field streams element with index %d: %w", idx, err)
|
||||
}
|
||||
b.Comma()
|
||||
}
|
||||
b.StripComma()
|
||||
b.ArrEnd()
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (v *VideoChatStreams) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if v == nil {
|
||||
return fmt.Errorf("can't decode videoChatStreams#58e70d9b to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("videoChatStreams"); err != nil {
|
||||
return fmt.Errorf("unable to decode videoChatStreams#58e70d9b: %w", err)
|
||||
}
|
||||
case "streams":
|
||||
if err := b.Arr(func(b tdjson.Decoder) error {
|
||||
var value VideoChatStream
|
||||
if err := value.DecodeTDLibJSON(b); err != nil {
|
||||
return fmt.Errorf("unable to decode videoChatStreams#58e70d9b: field streams: %w", err)
|
||||
}
|
||||
v.Streams = append(v.Streams, value)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("unable to decode videoChatStreams#58e70d9b: field streams: %w", err)
|
||||
}
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetStreams returns value of Streams field.
|
||||
func (v *VideoChatStreams) GetStreams() (value []VideoChatStream) {
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return v.Streams
|
||||
}
|
||||
Reference in New Issue
Block a user