7a04f298d2
- 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
203 lines
4.4 KiB
Go
Generated
203 lines
4.4 KiB
Go
Generated
// 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{}
|
|
)
|
|
|
|
// NewSessionCreated represents TL type `new_session_created#9ec20908`.
|
|
type NewSessionCreated struct {
|
|
// FirstMsgID field of NewSessionCreated.
|
|
FirstMsgID int64
|
|
// UniqueID field of NewSessionCreated.
|
|
UniqueID int64
|
|
// ServerSalt field of NewSessionCreated.
|
|
ServerSalt int64
|
|
}
|
|
|
|
// NewSessionCreatedTypeID is TL type id of NewSessionCreated.
|
|
const NewSessionCreatedTypeID = 0x9ec20908
|
|
|
|
// Ensuring interfaces in compile-time for NewSessionCreated.
|
|
var (
|
|
_ bin.Encoder = &NewSessionCreated{}
|
|
_ bin.Decoder = &NewSessionCreated{}
|
|
_ bin.BareEncoder = &NewSessionCreated{}
|
|
_ bin.BareDecoder = &NewSessionCreated{}
|
|
)
|
|
|
|
func (n *NewSessionCreated) Zero() bool {
|
|
if n == nil {
|
|
return true
|
|
}
|
|
if !(n.FirstMsgID == 0) {
|
|
return false
|
|
}
|
|
if !(n.UniqueID == 0) {
|
|
return false
|
|
}
|
|
if !(n.ServerSalt == 0) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (n *NewSessionCreated) String() string {
|
|
if n == nil {
|
|
return "NewSessionCreated(nil)"
|
|
}
|
|
type Alias NewSessionCreated
|
|
return fmt.Sprintf("NewSessionCreated%+v", Alias(*n))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*NewSessionCreated) TypeID() uint32 {
|
|
return NewSessionCreatedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*NewSessionCreated) TypeName() string {
|
|
return "new_session_created"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (n *NewSessionCreated) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "new_session_created",
|
|
ID: NewSessionCreatedTypeID,
|
|
}
|
|
if n == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "FirstMsgID",
|
|
SchemaName: "first_msg_id",
|
|
},
|
|
{
|
|
Name: "UniqueID",
|
|
SchemaName: "unique_id",
|
|
},
|
|
{
|
|
Name: "ServerSalt",
|
|
SchemaName: "server_salt",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (n *NewSessionCreated) Encode(b *bin.Buffer) error {
|
|
if n == nil {
|
|
return fmt.Errorf("can't encode new_session_created#9ec20908 as nil")
|
|
}
|
|
b.PutID(NewSessionCreatedTypeID)
|
|
return n.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (n *NewSessionCreated) EncodeBare(b *bin.Buffer) error {
|
|
if n == nil {
|
|
return fmt.Errorf("can't encode new_session_created#9ec20908 as nil")
|
|
}
|
|
b.PutLong(n.FirstMsgID)
|
|
b.PutLong(n.UniqueID)
|
|
b.PutLong(n.ServerSalt)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (n *NewSessionCreated) Decode(b *bin.Buffer) error {
|
|
if n == nil {
|
|
return fmt.Errorf("can't decode new_session_created#9ec20908 to nil")
|
|
}
|
|
if err := b.ConsumeID(NewSessionCreatedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode new_session_created#9ec20908: %w", err)
|
|
}
|
|
return n.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (n *NewSessionCreated) DecodeBare(b *bin.Buffer) error {
|
|
if n == nil {
|
|
return fmt.Errorf("can't decode new_session_created#9ec20908 to nil")
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode new_session_created#9ec20908: field first_msg_id: %w", err)
|
|
}
|
|
n.FirstMsgID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode new_session_created#9ec20908: field unique_id: %w", err)
|
|
}
|
|
n.UniqueID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode new_session_created#9ec20908: field server_salt: %w", err)
|
|
}
|
|
n.ServerSalt = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetFirstMsgID returns value of FirstMsgID field.
|
|
func (n *NewSessionCreated) GetFirstMsgID() (value int64) {
|
|
if n == nil {
|
|
return
|
|
}
|
|
return n.FirstMsgID
|
|
}
|
|
|
|
// GetUniqueID returns value of UniqueID field.
|
|
func (n *NewSessionCreated) GetUniqueID() (value int64) {
|
|
if n == nil {
|
|
return
|
|
}
|
|
return n.UniqueID
|
|
}
|
|
|
|
// GetServerSalt returns value of ServerSalt field.
|
|
func (n *NewSessionCreated) GetServerSalt() (value int64) {
|
|
if n == nil {
|
|
return
|
|
}
|
|
return n.ServerSalt
|
|
}
|