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,189 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// AccountTmpPassword represents TL type `account.tmpPassword#db64fd34`.
|
||||
// Temporary payment password
|
||||
//
|
||||
// See https://core.telegram.org/constructor/account.tmpPassword for reference.
|
||||
type AccountTmpPassword struct {
|
||||
// Temporary password
|
||||
TmpPassword []byte
|
||||
// Validity period
|
||||
ValidUntil int
|
||||
}
|
||||
|
||||
// AccountTmpPasswordTypeID is TL type id of AccountTmpPassword.
|
||||
const AccountTmpPasswordTypeID = 0xdb64fd34
|
||||
|
||||
// Ensuring interfaces in compile-time for AccountTmpPassword.
|
||||
var (
|
||||
_ bin.Encoder = &AccountTmpPassword{}
|
||||
_ bin.Decoder = &AccountTmpPassword{}
|
||||
_ bin.BareEncoder = &AccountTmpPassword{}
|
||||
_ bin.BareDecoder = &AccountTmpPassword{}
|
||||
)
|
||||
|
||||
func (t *AccountTmpPassword) Zero() bool {
|
||||
if t == nil {
|
||||
return true
|
||||
}
|
||||
if !(t.TmpPassword == nil) {
|
||||
return false
|
||||
}
|
||||
if !(t.ValidUntil == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (t *AccountTmpPassword) String() string {
|
||||
if t == nil {
|
||||
return "AccountTmpPassword(nil)"
|
||||
}
|
||||
type Alias AccountTmpPassword
|
||||
return fmt.Sprintf("AccountTmpPassword%+v", Alias(*t))
|
||||
}
|
||||
|
||||
// FillFrom fills AccountTmpPassword from given interface.
|
||||
func (t *AccountTmpPassword) FillFrom(from interface {
|
||||
GetTmpPassword() (value []byte)
|
||||
GetValidUntil() (value int)
|
||||
}) {
|
||||
t.TmpPassword = from.GetTmpPassword()
|
||||
t.ValidUntil = from.GetValidUntil()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*AccountTmpPassword) TypeID() uint32 {
|
||||
return AccountTmpPasswordTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*AccountTmpPassword) TypeName() string {
|
||||
return "account.tmpPassword"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (t *AccountTmpPassword) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "account.tmpPassword",
|
||||
ID: AccountTmpPasswordTypeID,
|
||||
}
|
||||
if t == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "TmpPassword",
|
||||
SchemaName: "tmp_password",
|
||||
},
|
||||
{
|
||||
Name: "ValidUntil",
|
||||
SchemaName: "valid_until",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (t *AccountTmpPassword) Encode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode account.tmpPassword#db64fd34 as nil")
|
||||
}
|
||||
b.PutID(AccountTmpPasswordTypeID)
|
||||
return t.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (t *AccountTmpPassword) EncodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode account.tmpPassword#db64fd34 as nil")
|
||||
}
|
||||
b.PutBytes(t.TmpPassword)
|
||||
b.PutInt(t.ValidUntil)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (t *AccountTmpPassword) Decode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode account.tmpPassword#db64fd34 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(AccountTmpPasswordTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode account.tmpPassword#db64fd34: %w", err)
|
||||
}
|
||||
return t.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (t *AccountTmpPassword) DecodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode account.tmpPassword#db64fd34 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.tmpPassword#db64fd34: field tmp_password: %w", err)
|
||||
}
|
||||
t.TmpPassword = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode account.tmpPassword#db64fd34: field valid_until: %w", err)
|
||||
}
|
||||
t.ValidUntil = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTmpPassword returns value of TmpPassword field.
|
||||
func (t *AccountTmpPassword) GetTmpPassword() (value []byte) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
return t.TmpPassword
|
||||
}
|
||||
|
||||
// GetValidUntil returns value of ValidUntil field.
|
||||
func (t *AccountTmpPassword) GetValidUntil() (value int) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
return t.ValidUntil
|
||||
}
|
||||
Reference in New Issue
Block a user