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,197 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tg
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// InputFolderPeer represents TL type `inputFolderPeer#fbd2c296`.
|
||||
// Peer in a folder
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputFolderPeer for reference.
|
||||
type InputFolderPeer struct {
|
||||
// Peer
|
||||
Peer InputPeerClass
|
||||
// Peer folder ID, for more info click here¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/folders#peer-folders
|
||||
FolderID int
|
||||
}
|
||||
|
||||
// InputFolderPeerTypeID is TL type id of InputFolderPeer.
|
||||
const InputFolderPeerTypeID = 0xfbd2c296
|
||||
|
||||
// Ensuring interfaces in compile-time for InputFolderPeer.
|
||||
var (
|
||||
_ bin.Encoder = &InputFolderPeer{}
|
||||
_ bin.Decoder = &InputFolderPeer{}
|
||||
_ bin.BareEncoder = &InputFolderPeer{}
|
||||
_ bin.BareDecoder = &InputFolderPeer{}
|
||||
)
|
||||
|
||||
func (i *InputFolderPeer) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(i.FolderID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputFolderPeer) String() string {
|
||||
if i == nil {
|
||||
return "InputFolderPeer(nil)"
|
||||
}
|
||||
type Alias InputFolderPeer
|
||||
return fmt.Sprintf("InputFolderPeer%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputFolderPeer from given interface.
|
||||
func (i *InputFolderPeer) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetFolderID() (value int)
|
||||
}) {
|
||||
i.Peer = from.GetPeer()
|
||||
i.FolderID = from.GetFolderID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputFolderPeer) TypeID() uint32 {
|
||||
return InputFolderPeerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputFolderPeer) TypeName() string {
|
||||
return "inputFolderPeer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputFolderPeer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputFolderPeer",
|
||||
ID: InputFolderPeerTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "FolderID",
|
||||
SchemaName: "folder_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputFolderPeer) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputFolderPeer#fbd2c296 as nil")
|
||||
}
|
||||
b.PutID(InputFolderPeerTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputFolderPeer) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputFolderPeer#fbd2c296 as nil")
|
||||
}
|
||||
if i.Peer == nil {
|
||||
return fmt.Errorf("unable to encode inputFolderPeer#fbd2c296: field peer is nil")
|
||||
}
|
||||
if err := i.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputFolderPeer#fbd2c296: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(i.FolderID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputFolderPeer) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputFolderPeer#fbd2c296 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputFolderPeerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputFolderPeer#fbd2c296: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputFolderPeer) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputFolderPeer#fbd2c296 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputFolderPeer#fbd2c296: field peer: %w", err)
|
||||
}
|
||||
i.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputFolderPeer#fbd2c296: field folder_id: %w", err)
|
||||
}
|
||||
i.FolderID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (i *InputFolderPeer) GetPeer() (value InputPeerClass) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Peer
|
||||
}
|
||||
|
||||
// GetFolderID returns value of FolderID field.
|
||||
func (i *InputFolderPeer) GetFolderID() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.FolderID
|
||||
}
|
||||
Reference in New Issue
Block a user