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,202 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package mt
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// FutureSalt represents TL type `future_salt#949d9dc`.
|
||||
type FutureSalt struct {
|
||||
// ValidSince field of FutureSalt.
|
||||
ValidSince int
|
||||
// ValidUntil field of FutureSalt.
|
||||
ValidUntil int
|
||||
// Salt field of FutureSalt.
|
||||
Salt int64
|
||||
}
|
||||
|
||||
// FutureSaltTypeID is TL type id of FutureSalt.
|
||||
const FutureSaltTypeID = 0x949d9dc
|
||||
|
||||
// Ensuring interfaces in compile-time for FutureSalt.
|
||||
var (
|
||||
_ bin.Encoder = &FutureSalt{}
|
||||
_ bin.Decoder = &FutureSalt{}
|
||||
_ bin.BareEncoder = &FutureSalt{}
|
||||
_ bin.BareDecoder = &FutureSalt{}
|
||||
)
|
||||
|
||||
func (f *FutureSalt) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.ValidSince == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.ValidUntil == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Salt == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *FutureSalt) String() string {
|
||||
if f == nil {
|
||||
return "FutureSalt(nil)"
|
||||
}
|
||||
type Alias FutureSalt
|
||||
return fmt.Sprintf("FutureSalt%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*FutureSalt) TypeID() uint32 {
|
||||
return FutureSaltTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*FutureSalt) TypeName() string {
|
||||
return "future_salt"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *FutureSalt) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "future_salt",
|
||||
ID: FutureSaltTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ValidSince",
|
||||
SchemaName: "valid_since",
|
||||
},
|
||||
{
|
||||
Name: "ValidUntil",
|
||||
SchemaName: "valid_until",
|
||||
},
|
||||
{
|
||||
Name: "Salt",
|
||||
SchemaName: "salt",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *FutureSalt) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode future_salt#949d9dc as nil")
|
||||
}
|
||||
b.PutID(FutureSaltTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *FutureSalt) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode future_salt#949d9dc as nil")
|
||||
}
|
||||
b.PutInt(f.ValidSince)
|
||||
b.PutInt(f.ValidUntil)
|
||||
b.PutLong(f.Salt)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *FutureSalt) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode future_salt#949d9dc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(FutureSaltTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode future_salt#949d9dc: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *FutureSalt) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode future_salt#949d9dc to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode future_salt#949d9dc: field valid_since: %w", err)
|
||||
}
|
||||
f.ValidSince = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode future_salt#949d9dc: field valid_until: %w", err)
|
||||
}
|
||||
f.ValidUntil = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode future_salt#949d9dc: field salt: %w", err)
|
||||
}
|
||||
f.Salt = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetValidSince returns value of ValidSince field.
|
||||
func (f *FutureSalt) GetValidSince() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.ValidSince
|
||||
}
|
||||
|
||||
// GetValidUntil returns value of ValidUntil field.
|
||||
func (f *FutureSalt) GetValidUntil() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.ValidUntil
|
||||
}
|
||||
|
||||
// GetSalt returns value of Salt field.
|
||||
func (f *FutureSalt) GetSalt() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Salt
|
||||
}
|
||||
Reference in New Issue
Block a user