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,5 @@
|
||||
// Package mt contains generated code based on mtproto schema.
|
||||
//
|
||||
// See https://core.telegram.org/schema/mtproto for reference.
|
||||
// Some types are implemented manually in "proto" package.
|
||||
package mt
|
||||
@@ -0,0 +1,501 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BadMsgNotification represents TL type `bad_msg_notification#a7eff811`.
|
||||
type BadMsgNotification struct {
|
||||
// BadMsgID field of BadMsgNotification.
|
||||
BadMsgID int64
|
||||
// BadMsgSeqno field of BadMsgNotification.
|
||||
BadMsgSeqno int
|
||||
// ErrorCode field of BadMsgNotification.
|
||||
ErrorCode int
|
||||
}
|
||||
|
||||
// BadMsgNotificationTypeID is TL type id of BadMsgNotification.
|
||||
const BadMsgNotificationTypeID = 0xa7eff811
|
||||
|
||||
// construct implements constructor of BadMsgNotificationClass.
|
||||
func (b BadMsgNotification) construct() BadMsgNotificationClass { return &b }
|
||||
|
||||
// Ensuring interfaces in compile-time for BadMsgNotification.
|
||||
var (
|
||||
_ bin.Encoder = &BadMsgNotification{}
|
||||
_ bin.Decoder = &BadMsgNotification{}
|
||||
_ bin.BareEncoder = &BadMsgNotification{}
|
||||
_ bin.BareDecoder = &BadMsgNotification{}
|
||||
|
||||
_ BadMsgNotificationClass = &BadMsgNotification{}
|
||||
)
|
||||
|
||||
func (b *BadMsgNotification) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
if !(b.BadMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(b.BadMsgSeqno == 0) {
|
||||
return false
|
||||
}
|
||||
if !(b.ErrorCode == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BadMsgNotification) String() string {
|
||||
if b == nil {
|
||||
return "BadMsgNotification(nil)"
|
||||
}
|
||||
type Alias BadMsgNotification
|
||||
return fmt.Sprintf("BadMsgNotification%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BadMsgNotification) TypeID() uint32 {
|
||||
return BadMsgNotificationTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BadMsgNotification) TypeName() string {
|
||||
return "bad_msg_notification"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BadMsgNotification) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bad_msg_notification",
|
||||
ID: BadMsgNotificationTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BadMsgID",
|
||||
SchemaName: "bad_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "BadMsgSeqno",
|
||||
SchemaName: "bad_msg_seqno",
|
||||
},
|
||||
{
|
||||
Name: "ErrorCode",
|
||||
SchemaName: "error_code",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BadMsgNotification) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bad_msg_notification#a7eff811 as nil")
|
||||
}
|
||||
buf.PutID(BadMsgNotificationTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BadMsgNotification) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bad_msg_notification#a7eff811 as nil")
|
||||
}
|
||||
buf.PutLong(b.BadMsgID)
|
||||
buf.PutInt(b.BadMsgSeqno)
|
||||
buf.PutInt(b.ErrorCode)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BadMsgNotification) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bad_msg_notification#a7eff811 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BadMsgNotificationTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bad_msg_notification#a7eff811: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BadMsgNotification) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bad_msg_notification#a7eff811 to nil")
|
||||
}
|
||||
{
|
||||
value, err := buf.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_msg_notification#a7eff811: field bad_msg_id: %w", err)
|
||||
}
|
||||
b.BadMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := buf.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_msg_notification#a7eff811: field bad_msg_seqno: %w", err)
|
||||
}
|
||||
b.BadMsgSeqno = value
|
||||
}
|
||||
{
|
||||
value, err := buf.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_msg_notification#a7eff811: field error_code: %w", err)
|
||||
}
|
||||
b.ErrorCode = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBadMsgID returns value of BadMsgID field.
|
||||
func (b *BadMsgNotification) GetBadMsgID() (value int64) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.BadMsgID
|
||||
}
|
||||
|
||||
// GetBadMsgSeqno returns value of BadMsgSeqno field.
|
||||
func (b *BadMsgNotification) GetBadMsgSeqno() (value int) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.BadMsgSeqno
|
||||
}
|
||||
|
||||
// GetErrorCode returns value of ErrorCode field.
|
||||
func (b *BadMsgNotification) GetErrorCode() (value int) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.ErrorCode
|
||||
}
|
||||
|
||||
// BadServerSalt represents TL type `bad_server_salt#edab447b`.
|
||||
type BadServerSalt struct {
|
||||
// BadMsgID field of BadServerSalt.
|
||||
BadMsgID int64
|
||||
// BadMsgSeqno field of BadServerSalt.
|
||||
BadMsgSeqno int
|
||||
// ErrorCode field of BadServerSalt.
|
||||
ErrorCode int
|
||||
// NewServerSalt field of BadServerSalt.
|
||||
NewServerSalt int64
|
||||
}
|
||||
|
||||
// BadServerSaltTypeID is TL type id of BadServerSalt.
|
||||
const BadServerSaltTypeID = 0xedab447b
|
||||
|
||||
// construct implements constructor of BadMsgNotificationClass.
|
||||
func (b BadServerSalt) construct() BadMsgNotificationClass { return &b }
|
||||
|
||||
// Ensuring interfaces in compile-time for BadServerSalt.
|
||||
var (
|
||||
_ bin.Encoder = &BadServerSalt{}
|
||||
_ bin.Decoder = &BadServerSalt{}
|
||||
_ bin.BareEncoder = &BadServerSalt{}
|
||||
_ bin.BareDecoder = &BadServerSalt{}
|
||||
|
||||
_ BadMsgNotificationClass = &BadServerSalt{}
|
||||
)
|
||||
|
||||
func (b *BadServerSalt) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
if !(b.BadMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(b.BadMsgSeqno == 0) {
|
||||
return false
|
||||
}
|
||||
if !(b.ErrorCode == 0) {
|
||||
return false
|
||||
}
|
||||
if !(b.NewServerSalt == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BadServerSalt) String() string {
|
||||
if b == nil {
|
||||
return "BadServerSalt(nil)"
|
||||
}
|
||||
type Alias BadServerSalt
|
||||
return fmt.Sprintf("BadServerSalt%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BadServerSalt) TypeID() uint32 {
|
||||
return BadServerSaltTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BadServerSalt) TypeName() string {
|
||||
return "bad_server_salt"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BadServerSalt) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "bad_server_salt",
|
||||
ID: BadServerSaltTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BadMsgID",
|
||||
SchemaName: "bad_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "BadMsgSeqno",
|
||||
SchemaName: "bad_msg_seqno",
|
||||
},
|
||||
{
|
||||
Name: "ErrorCode",
|
||||
SchemaName: "error_code",
|
||||
},
|
||||
{
|
||||
Name: "NewServerSalt",
|
||||
SchemaName: "new_server_salt",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BadServerSalt) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bad_server_salt#edab447b as nil")
|
||||
}
|
||||
buf.PutID(BadServerSaltTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BadServerSalt) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode bad_server_salt#edab447b as nil")
|
||||
}
|
||||
buf.PutLong(b.BadMsgID)
|
||||
buf.PutInt(b.BadMsgSeqno)
|
||||
buf.PutInt(b.ErrorCode)
|
||||
buf.PutLong(b.NewServerSalt)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BadServerSalt) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bad_server_salt#edab447b to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BadServerSaltTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode bad_server_salt#edab447b: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BadServerSalt) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode bad_server_salt#edab447b to nil")
|
||||
}
|
||||
{
|
||||
value, err := buf.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_server_salt#edab447b: field bad_msg_id: %w", err)
|
||||
}
|
||||
b.BadMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := buf.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_server_salt#edab447b: field bad_msg_seqno: %w", err)
|
||||
}
|
||||
b.BadMsgSeqno = value
|
||||
}
|
||||
{
|
||||
value, err := buf.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_server_salt#edab447b: field error_code: %w", err)
|
||||
}
|
||||
b.ErrorCode = value
|
||||
}
|
||||
{
|
||||
value, err := buf.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode bad_server_salt#edab447b: field new_server_salt: %w", err)
|
||||
}
|
||||
b.NewServerSalt = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBadMsgID returns value of BadMsgID field.
|
||||
func (b *BadServerSalt) GetBadMsgID() (value int64) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.BadMsgID
|
||||
}
|
||||
|
||||
// GetBadMsgSeqno returns value of BadMsgSeqno field.
|
||||
func (b *BadServerSalt) GetBadMsgSeqno() (value int) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.BadMsgSeqno
|
||||
}
|
||||
|
||||
// GetErrorCode returns value of ErrorCode field.
|
||||
func (b *BadServerSalt) GetErrorCode() (value int) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.ErrorCode
|
||||
}
|
||||
|
||||
// GetNewServerSalt returns value of NewServerSalt field.
|
||||
func (b *BadServerSalt) GetNewServerSalt() (value int64) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.NewServerSalt
|
||||
}
|
||||
|
||||
// BadMsgNotificationClassName is schema name of BadMsgNotificationClass.
|
||||
const BadMsgNotificationClassName = "BadMsgNotification"
|
||||
|
||||
// BadMsgNotificationClass represents BadMsgNotification generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodeBadMsgNotification(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.BadMsgNotification: // bad_msg_notification#a7eff811
|
||||
// case *mt.BadServerSalt: // bad_server_salt#edab447b
|
||||
// default: panic(v)
|
||||
// }
|
||||
type BadMsgNotificationClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() BadMsgNotificationClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// BadMsgID field of BadMsgNotification.
|
||||
GetBadMsgID() (value int64)
|
||||
// BadMsgSeqno field of BadMsgNotification.
|
||||
GetBadMsgSeqno() (value int)
|
||||
// ErrorCode field of BadMsgNotification.
|
||||
GetErrorCode() (value int)
|
||||
}
|
||||
|
||||
// DecodeBadMsgNotification implements binary de-serialization for BadMsgNotificationClass.
|
||||
func DecodeBadMsgNotification(buf *bin.Buffer) (BadMsgNotificationClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case BadMsgNotificationTypeID:
|
||||
// Decoding bad_msg_notification#a7eff811.
|
||||
v := BadMsgNotification{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode BadMsgNotificationClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case BadServerSaltTypeID:
|
||||
// Decoding bad_server_salt#edab447b.
|
||||
v := BadServerSalt{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode BadMsgNotificationClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode BadMsgNotificationClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// BadMsgNotification boxes the BadMsgNotificationClass providing a helper.
|
||||
type BadMsgNotificationBox struct {
|
||||
BadMsgNotification BadMsgNotificationClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for BadMsgNotificationBox.
|
||||
func (b *BadMsgNotificationBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode BadMsgNotificationBox to nil")
|
||||
}
|
||||
v, err := DecodeBadMsgNotification(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.BadMsgNotification = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for BadMsgNotificationBox.
|
||||
func (b *BadMsgNotificationBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.BadMsgNotification == nil {
|
||||
return fmt.Errorf("unable to encode BadMsgNotificationClass as nil")
|
||||
}
|
||||
return b.BadMsgNotification.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ClientDHInnerData represents TL type `client_DH_inner_data#6643b654`.
|
||||
type ClientDHInnerData struct {
|
||||
// Nonce field of ClientDHInnerData.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of ClientDHInnerData.
|
||||
ServerNonce bin.Int128
|
||||
// RetryID field of ClientDHInnerData.
|
||||
RetryID int64
|
||||
// GB field of ClientDHInnerData.
|
||||
GB []byte
|
||||
}
|
||||
|
||||
// ClientDHInnerDataTypeID is TL type id of ClientDHInnerData.
|
||||
const ClientDHInnerDataTypeID = 0x6643b654
|
||||
|
||||
// Ensuring interfaces in compile-time for ClientDHInnerData.
|
||||
var (
|
||||
_ bin.Encoder = &ClientDHInnerData{}
|
||||
_ bin.Decoder = &ClientDHInnerData{}
|
||||
_ bin.BareEncoder = &ClientDHInnerData{}
|
||||
_ bin.BareDecoder = &ClientDHInnerData{}
|
||||
)
|
||||
|
||||
func (c *ClientDHInnerData) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(c.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(c.RetryID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.GB == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *ClientDHInnerData) String() string {
|
||||
if c == nil {
|
||||
return "ClientDHInnerData(nil)"
|
||||
}
|
||||
type Alias ClientDHInnerData
|
||||
return fmt.Sprintf("ClientDHInnerData%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ClientDHInnerData) TypeID() uint32 {
|
||||
return ClientDHInnerDataTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ClientDHInnerData) TypeName() string {
|
||||
return "client_DH_inner_data"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *ClientDHInnerData) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "client_DH_inner_data",
|
||||
ID: ClientDHInnerDataTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "RetryID",
|
||||
SchemaName: "retry_id",
|
||||
},
|
||||
{
|
||||
Name: "GB",
|
||||
SchemaName: "g_b",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ClientDHInnerData) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode client_DH_inner_data#6643b654 as nil")
|
||||
}
|
||||
b.PutID(ClientDHInnerDataTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ClientDHInnerData) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode client_DH_inner_data#6643b654 as nil")
|
||||
}
|
||||
b.PutInt128(c.Nonce)
|
||||
b.PutInt128(c.ServerNonce)
|
||||
b.PutLong(c.RetryID)
|
||||
b.PutBytes(c.GB)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ClientDHInnerData) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode client_DH_inner_data#6643b654 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ClientDHInnerDataTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ClientDHInnerData) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode client_DH_inner_data#6643b654 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field nonce: %w", err)
|
||||
}
|
||||
c.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field server_nonce: %w", err)
|
||||
}
|
||||
c.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field retry_id: %w", err)
|
||||
}
|
||||
c.RetryID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode client_DH_inner_data#6643b654: field g_b: %w", err)
|
||||
}
|
||||
c.GB = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (c *ClientDHInnerData) GetNonce() (value bin.Int128) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (c *ClientDHInnerData) GetServerNonce() (value bin.Int128) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.ServerNonce
|
||||
}
|
||||
|
||||
// GetRetryID returns value of RetryID field.
|
||||
func (c *ClientDHInnerData) GetRetryID() (value int64) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.RetryID
|
||||
}
|
||||
|
||||
// GetGB returns value of GB field.
|
||||
func (c *ClientDHInnerData) GetGB() (value []byte) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.GB
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// DestroySessionRequest represents TL type `destroy_session#e7512126`.
|
||||
type DestroySessionRequest struct {
|
||||
// SessionID field of DestroySessionRequest.
|
||||
SessionID int64
|
||||
}
|
||||
|
||||
// DestroySessionRequestTypeID is TL type id of DestroySessionRequest.
|
||||
const DestroySessionRequestTypeID = 0xe7512126
|
||||
|
||||
// Ensuring interfaces in compile-time for DestroySessionRequest.
|
||||
var (
|
||||
_ bin.Encoder = &DestroySessionRequest{}
|
||||
_ bin.Decoder = &DestroySessionRequest{}
|
||||
_ bin.BareEncoder = &DestroySessionRequest{}
|
||||
_ bin.BareDecoder = &DestroySessionRequest{}
|
||||
)
|
||||
|
||||
func (d *DestroySessionRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.SessionID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DestroySessionRequest) String() string {
|
||||
if d == nil {
|
||||
return "DestroySessionRequest(nil)"
|
||||
}
|
||||
type Alias DestroySessionRequest
|
||||
return fmt.Sprintf("DestroySessionRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DestroySessionRequest) TypeID() uint32 {
|
||||
return DestroySessionRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DestroySessionRequest) TypeName() string {
|
||||
return "destroy_session"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DestroySessionRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "destroy_session",
|
||||
ID: DestroySessionRequestTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SessionID",
|
||||
SchemaName: "session_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DestroySessionRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode destroy_session#e7512126 as nil")
|
||||
}
|
||||
b.PutID(DestroySessionRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DestroySessionRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode destroy_session#e7512126 as nil")
|
||||
}
|
||||
b.PutLong(d.SessionID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DestroySessionRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode destroy_session#e7512126 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DestroySessionRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode destroy_session#e7512126: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DestroySessionRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode destroy_session#e7512126 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode destroy_session#e7512126: field session_id: %w", err)
|
||||
}
|
||||
d.SessionID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSessionID returns value of SessionID field.
|
||||
func (d *DestroySessionRequest) GetSessionID() (value int64) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.SessionID
|
||||
}
|
||||
@@ -0,0 +1,372 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// DestroySessionOk represents TL type `destroy_session_ok#e22045fc`.
|
||||
type DestroySessionOk struct {
|
||||
// SessionID field of DestroySessionOk.
|
||||
SessionID int64
|
||||
}
|
||||
|
||||
// DestroySessionOkTypeID is TL type id of DestroySessionOk.
|
||||
const DestroySessionOkTypeID = 0xe22045fc
|
||||
|
||||
// construct implements constructor of DestroySessionResClass.
|
||||
func (d DestroySessionOk) construct() DestroySessionResClass { return &d }
|
||||
|
||||
// Ensuring interfaces in compile-time for DestroySessionOk.
|
||||
var (
|
||||
_ bin.Encoder = &DestroySessionOk{}
|
||||
_ bin.Decoder = &DestroySessionOk{}
|
||||
_ bin.BareEncoder = &DestroySessionOk{}
|
||||
_ bin.BareDecoder = &DestroySessionOk{}
|
||||
|
||||
_ DestroySessionResClass = &DestroySessionOk{}
|
||||
)
|
||||
|
||||
func (d *DestroySessionOk) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.SessionID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DestroySessionOk) String() string {
|
||||
if d == nil {
|
||||
return "DestroySessionOk(nil)"
|
||||
}
|
||||
type Alias DestroySessionOk
|
||||
return fmt.Sprintf("DestroySessionOk%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DestroySessionOk) TypeID() uint32 {
|
||||
return DestroySessionOkTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DestroySessionOk) TypeName() string {
|
||||
return "destroy_session_ok"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DestroySessionOk) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "destroy_session_ok",
|
||||
ID: DestroySessionOkTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SessionID",
|
||||
SchemaName: "session_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DestroySessionOk) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode destroy_session_ok#e22045fc as nil")
|
||||
}
|
||||
b.PutID(DestroySessionOkTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DestroySessionOk) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode destroy_session_ok#e22045fc as nil")
|
||||
}
|
||||
b.PutLong(d.SessionID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DestroySessionOk) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode destroy_session_ok#e22045fc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DestroySessionOkTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode destroy_session_ok#e22045fc: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DestroySessionOk) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode destroy_session_ok#e22045fc to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode destroy_session_ok#e22045fc: field session_id: %w", err)
|
||||
}
|
||||
d.SessionID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSessionID returns value of SessionID field.
|
||||
func (d *DestroySessionOk) GetSessionID() (value int64) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.SessionID
|
||||
}
|
||||
|
||||
// DestroySessionNone represents TL type `destroy_session_none#62d350c9`.
|
||||
type DestroySessionNone struct {
|
||||
// SessionID field of DestroySessionNone.
|
||||
SessionID int64
|
||||
}
|
||||
|
||||
// DestroySessionNoneTypeID is TL type id of DestroySessionNone.
|
||||
const DestroySessionNoneTypeID = 0x62d350c9
|
||||
|
||||
// construct implements constructor of DestroySessionResClass.
|
||||
func (d DestroySessionNone) construct() DestroySessionResClass { return &d }
|
||||
|
||||
// Ensuring interfaces in compile-time for DestroySessionNone.
|
||||
var (
|
||||
_ bin.Encoder = &DestroySessionNone{}
|
||||
_ bin.Decoder = &DestroySessionNone{}
|
||||
_ bin.BareEncoder = &DestroySessionNone{}
|
||||
_ bin.BareDecoder = &DestroySessionNone{}
|
||||
|
||||
_ DestroySessionResClass = &DestroySessionNone{}
|
||||
)
|
||||
|
||||
func (d *DestroySessionNone) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.SessionID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DestroySessionNone) String() string {
|
||||
if d == nil {
|
||||
return "DestroySessionNone(nil)"
|
||||
}
|
||||
type Alias DestroySessionNone
|
||||
return fmt.Sprintf("DestroySessionNone%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DestroySessionNone) TypeID() uint32 {
|
||||
return DestroySessionNoneTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DestroySessionNone) TypeName() string {
|
||||
return "destroy_session_none"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DestroySessionNone) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "destroy_session_none",
|
||||
ID: DestroySessionNoneTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SessionID",
|
||||
SchemaName: "session_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DestroySessionNone) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode destroy_session_none#62d350c9 as nil")
|
||||
}
|
||||
b.PutID(DestroySessionNoneTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DestroySessionNone) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode destroy_session_none#62d350c9 as nil")
|
||||
}
|
||||
b.PutLong(d.SessionID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DestroySessionNone) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode destroy_session_none#62d350c9 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DestroySessionNoneTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode destroy_session_none#62d350c9: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DestroySessionNone) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode destroy_session_none#62d350c9 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode destroy_session_none#62d350c9: field session_id: %w", err)
|
||||
}
|
||||
d.SessionID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSessionID returns value of SessionID field.
|
||||
func (d *DestroySessionNone) GetSessionID() (value int64) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.SessionID
|
||||
}
|
||||
|
||||
// DestroySessionResClassName is schema name of DestroySessionResClass.
|
||||
const DestroySessionResClassName = "DestroySessionRes"
|
||||
|
||||
// DestroySessionResClass represents DestroySessionRes generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodeDestroySessionRes(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.DestroySessionOk: // destroy_session_ok#e22045fc
|
||||
// case *mt.DestroySessionNone: // destroy_session_none#62d350c9
|
||||
// default: panic(v)
|
||||
// }
|
||||
type DestroySessionResClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() DestroySessionResClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// SessionID field of DestroySessionOk.
|
||||
GetSessionID() (value int64)
|
||||
}
|
||||
|
||||
// DecodeDestroySessionRes implements binary de-serialization for DestroySessionResClass.
|
||||
func DecodeDestroySessionRes(buf *bin.Buffer) (DestroySessionResClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case DestroySessionOkTypeID:
|
||||
// Decoding destroy_session_ok#e22045fc.
|
||||
v := DestroySessionOk{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode DestroySessionResClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case DestroySessionNoneTypeID:
|
||||
// Decoding destroy_session_none#62d350c9.
|
||||
v := DestroySessionNone{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode DestroySessionResClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode DestroySessionResClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// DestroySessionRes boxes the DestroySessionResClass providing a helper.
|
||||
type DestroySessionResBox struct {
|
||||
DestroySessionRes DestroySessionResClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for DestroySessionResBox.
|
||||
func (b *DestroySessionResBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode DestroySessionResBox to nil")
|
||||
}
|
||||
v, err := DecodeDestroySessionRes(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.DestroySessionRes = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for DestroySessionResBox.
|
||||
func (b *DestroySessionResBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.DestroySessionRes == nil {
|
||||
return fmt.Errorf("unable to encode DestroySessionResClass as nil")
|
||||
}
|
||||
return b.DestroySessionRes.Encode(buf)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// FutureSalts represents TL type `future_salts#ae500895`.
|
||||
type FutureSalts struct {
|
||||
// ReqMsgID field of FutureSalts.
|
||||
ReqMsgID int64
|
||||
// Now field of FutureSalts.
|
||||
Now int
|
||||
// Salts field of FutureSalts.
|
||||
Salts []FutureSalt
|
||||
}
|
||||
|
||||
// FutureSaltsTypeID is TL type id of FutureSalts.
|
||||
const FutureSaltsTypeID = 0xae500895
|
||||
|
||||
// Ensuring interfaces in compile-time for FutureSalts.
|
||||
var (
|
||||
_ bin.Encoder = &FutureSalts{}
|
||||
_ bin.Decoder = &FutureSalts{}
|
||||
_ bin.BareEncoder = &FutureSalts{}
|
||||
_ bin.BareDecoder = &FutureSalts{}
|
||||
)
|
||||
|
||||
func (f *FutureSalts) Zero() bool {
|
||||
if f == nil {
|
||||
return true
|
||||
}
|
||||
if !(f.ReqMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Now == 0) {
|
||||
return false
|
||||
}
|
||||
if !(f.Salts == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (f *FutureSalts) String() string {
|
||||
if f == nil {
|
||||
return "FutureSalts(nil)"
|
||||
}
|
||||
type Alias FutureSalts
|
||||
return fmt.Sprintf("FutureSalts%+v", Alias(*f))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*FutureSalts) TypeID() uint32 {
|
||||
return FutureSaltsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*FutureSalts) TypeName() string {
|
||||
return "future_salts"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (f *FutureSalts) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "future_salts",
|
||||
ID: FutureSaltsTypeID,
|
||||
}
|
||||
if f == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ReqMsgID",
|
||||
SchemaName: "req_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Now",
|
||||
SchemaName: "now",
|
||||
},
|
||||
{
|
||||
Name: "Salts",
|
||||
SchemaName: "salts",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (f *FutureSalts) Encode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode future_salts#ae500895 as nil")
|
||||
}
|
||||
b.PutID(FutureSaltsTypeID)
|
||||
return f.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (f *FutureSalts) EncodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't encode future_salts#ae500895 as nil")
|
||||
}
|
||||
b.PutLong(f.ReqMsgID)
|
||||
b.PutInt(f.Now)
|
||||
b.PutInt(len(f.Salts))
|
||||
for idx, v := range f.Salts {
|
||||
if err := v.EncodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bare future_salts#ae500895: field salts element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (f *FutureSalts) Decode(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode future_salts#ae500895 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(FutureSaltsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode future_salts#ae500895: %w", err)
|
||||
}
|
||||
return f.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (f *FutureSalts) DecodeBare(b *bin.Buffer) error {
|
||||
if f == nil {
|
||||
return fmt.Errorf("can't decode future_salts#ae500895 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode future_salts#ae500895: field req_msg_id: %w", err)
|
||||
}
|
||||
f.ReqMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode future_salts#ae500895: field now: %w", err)
|
||||
}
|
||||
f.Now = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode future_salts#ae500895: field salts: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
f.Salts = make([]FutureSalt, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value FutureSalt
|
||||
if err := value.DecodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to decode bare future_salts#ae500895: field salts: %w", err)
|
||||
}
|
||||
f.Salts = append(f.Salts, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetReqMsgID returns value of ReqMsgID field.
|
||||
func (f *FutureSalts) GetReqMsgID() (value int64) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.ReqMsgID
|
||||
}
|
||||
|
||||
// GetNow returns value of Now field.
|
||||
func (f *FutureSalts) GetNow() (value int) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Now
|
||||
}
|
||||
|
||||
// GetSalts returns value of Salts field.
|
||||
func (f *FutureSalts) GetSalts() (value []FutureSalt) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
return f.Salts
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GetFutureSaltsRequest represents TL type `get_future_salts#b921bd04`.
|
||||
type GetFutureSaltsRequest struct {
|
||||
// Num field of GetFutureSaltsRequest.
|
||||
Num int
|
||||
}
|
||||
|
||||
// GetFutureSaltsRequestTypeID is TL type id of GetFutureSaltsRequest.
|
||||
const GetFutureSaltsRequestTypeID = 0xb921bd04
|
||||
|
||||
// Ensuring interfaces in compile-time for GetFutureSaltsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &GetFutureSaltsRequest{}
|
||||
_ bin.Decoder = &GetFutureSaltsRequest{}
|
||||
_ bin.BareEncoder = &GetFutureSaltsRequest{}
|
||||
_ bin.BareDecoder = &GetFutureSaltsRequest{}
|
||||
)
|
||||
|
||||
func (g *GetFutureSaltsRequest) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.Num == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GetFutureSaltsRequest) String() string {
|
||||
if g == nil {
|
||||
return "GetFutureSaltsRequest(nil)"
|
||||
}
|
||||
type Alias GetFutureSaltsRequest
|
||||
return fmt.Sprintf("GetFutureSaltsRequest%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GetFutureSaltsRequest) TypeID() uint32 {
|
||||
return GetFutureSaltsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GetFutureSaltsRequest) TypeName() string {
|
||||
return "get_future_salts"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GetFutureSaltsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "get_future_salts",
|
||||
ID: GetFutureSaltsRequestTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Num",
|
||||
SchemaName: "num",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GetFutureSaltsRequest) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode get_future_salts#b921bd04 as nil")
|
||||
}
|
||||
b.PutID(GetFutureSaltsRequestTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GetFutureSaltsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode get_future_salts#b921bd04 as nil")
|
||||
}
|
||||
b.PutInt(g.Num)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GetFutureSaltsRequest) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode get_future_salts#b921bd04 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GetFutureSaltsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode get_future_salts#b921bd04: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GetFutureSaltsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode get_future_salts#b921bd04 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode get_future_salts#b921bd04: field num: %w", err)
|
||||
}
|
||||
g.Num = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNum returns value of Num field.
|
||||
func (g *GetFutureSaltsRequest) GetNum() (value int) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.Num
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// GzipPacked represents TL type `gzip_packed#3072cfa1`.
|
||||
type GzipPacked struct {
|
||||
// PackedData field of GzipPacked.
|
||||
PackedData []byte
|
||||
}
|
||||
|
||||
// GzipPackedTypeID is TL type id of GzipPacked.
|
||||
const GzipPackedTypeID = 0x3072cfa1
|
||||
|
||||
// Ensuring interfaces in compile-time for GzipPacked.
|
||||
var (
|
||||
_ bin.Encoder = &GzipPacked{}
|
||||
_ bin.Decoder = &GzipPacked{}
|
||||
_ bin.BareEncoder = &GzipPacked{}
|
||||
_ bin.BareDecoder = &GzipPacked{}
|
||||
)
|
||||
|
||||
func (g *GzipPacked) Zero() bool {
|
||||
if g == nil {
|
||||
return true
|
||||
}
|
||||
if !(g.PackedData == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (g *GzipPacked) String() string {
|
||||
if g == nil {
|
||||
return "GzipPacked(nil)"
|
||||
}
|
||||
type Alias GzipPacked
|
||||
return fmt.Sprintf("GzipPacked%+v", Alias(*g))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*GzipPacked) TypeID() uint32 {
|
||||
return GzipPackedTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*GzipPacked) TypeName() string {
|
||||
return "gzip_packed"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (g *GzipPacked) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "gzip_packed",
|
||||
ID: GzipPackedTypeID,
|
||||
}
|
||||
if g == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PackedData",
|
||||
SchemaName: "packed_data",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (g *GzipPacked) Encode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode gzip_packed#3072cfa1 as nil")
|
||||
}
|
||||
b.PutID(GzipPackedTypeID)
|
||||
return g.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (g *GzipPacked) EncodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't encode gzip_packed#3072cfa1 as nil")
|
||||
}
|
||||
b.PutBytes(g.PackedData)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (g *GzipPacked) Decode(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode gzip_packed#3072cfa1 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(GzipPackedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode gzip_packed#3072cfa1: %w", err)
|
||||
}
|
||||
return g.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (g *GzipPacked) DecodeBare(b *bin.Buffer) error {
|
||||
if g == nil {
|
||||
return fmt.Errorf("can't decode gzip_packed#3072cfa1 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode gzip_packed#3072cfa1: field packed_data: %w", err)
|
||||
}
|
||||
g.PackedData = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPackedData returns value of PackedData field.
|
||||
func (g *GzipPacked) GetPackedData() (value []byte) {
|
||||
if g == nil {
|
||||
return
|
||||
}
|
||||
return g.PackedData
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
|
||||
// HTTPWaitRequest represents TL type `http_wait#9299359f`.
|
||||
type HTTPWaitRequest struct {
|
||||
// MaxDelay field of HTTPWaitRequest.
|
||||
MaxDelay int
|
||||
// WaitAfter field of HTTPWaitRequest.
|
||||
WaitAfter int
|
||||
// MaxWait field of HTTPWaitRequest.
|
||||
MaxWait int
|
||||
}
|
||||
|
||||
// HTTPWaitRequestTypeID is TL type id of HTTPWaitRequest.
|
||||
const HTTPWaitRequestTypeID = 0x9299359f
|
||||
|
||||
// Ensuring interfaces in compile-time for HTTPWaitRequest.
|
||||
var (
|
||||
_ bin.Encoder = &HTTPWaitRequest{}
|
||||
_ bin.Decoder = &HTTPWaitRequest{}
|
||||
_ bin.BareEncoder = &HTTPWaitRequest{}
|
||||
_ bin.BareDecoder = &HTTPWaitRequest{}
|
||||
)
|
||||
|
||||
func (h *HTTPWaitRequest) Zero() bool {
|
||||
if h == nil {
|
||||
return true
|
||||
}
|
||||
if !(h.MaxDelay == 0) {
|
||||
return false
|
||||
}
|
||||
if !(h.WaitAfter == 0) {
|
||||
return false
|
||||
}
|
||||
if !(h.MaxWait == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (h *HTTPWaitRequest) String() string {
|
||||
if h == nil {
|
||||
return "HTTPWaitRequest(nil)"
|
||||
}
|
||||
type Alias HTTPWaitRequest
|
||||
return fmt.Sprintf("HTTPWaitRequest%+v", Alias(*h))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*HTTPWaitRequest) TypeID() uint32 {
|
||||
return HTTPWaitRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*HTTPWaitRequest) TypeName() string {
|
||||
return "http_wait"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (h *HTTPWaitRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "http_wait",
|
||||
ID: HTTPWaitRequestTypeID,
|
||||
}
|
||||
if h == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MaxDelay",
|
||||
SchemaName: "max_delay",
|
||||
},
|
||||
{
|
||||
Name: "WaitAfter",
|
||||
SchemaName: "wait_after",
|
||||
},
|
||||
{
|
||||
Name: "MaxWait",
|
||||
SchemaName: "max_wait",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (h *HTTPWaitRequest) Encode(b *bin.Buffer) error {
|
||||
if h == nil {
|
||||
return fmt.Errorf("can't encode http_wait#9299359f as nil")
|
||||
}
|
||||
b.PutID(HTTPWaitRequestTypeID)
|
||||
return h.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (h *HTTPWaitRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if h == nil {
|
||||
return fmt.Errorf("can't encode http_wait#9299359f as nil")
|
||||
}
|
||||
b.PutInt(h.MaxDelay)
|
||||
b.PutInt(h.WaitAfter)
|
||||
b.PutInt(h.MaxWait)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (h *HTTPWaitRequest) Decode(b *bin.Buffer) error {
|
||||
if h == nil {
|
||||
return fmt.Errorf("can't decode http_wait#9299359f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(HTTPWaitRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode http_wait#9299359f: %w", err)
|
||||
}
|
||||
return h.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (h *HTTPWaitRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if h == nil {
|
||||
return fmt.Errorf("can't decode http_wait#9299359f to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode http_wait#9299359f: field max_delay: %w", err)
|
||||
}
|
||||
h.MaxDelay = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode http_wait#9299359f: field wait_after: %w", err)
|
||||
}
|
||||
h.WaitAfter = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode http_wait#9299359f: field max_wait: %w", err)
|
||||
}
|
||||
h.MaxWait = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMaxDelay returns value of MaxDelay field.
|
||||
func (h *HTTPWaitRequest) GetMaxDelay() (value int) {
|
||||
if h == nil {
|
||||
return
|
||||
}
|
||||
return h.MaxDelay
|
||||
}
|
||||
|
||||
// GetWaitAfter returns value of WaitAfter field.
|
||||
func (h *HTTPWaitRequest) GetWaitAfter() (value int) {
|
||||
if h == nil {
|
||||
return
|
||||
}
|
||||
return h.WaitAfter
|
||||
}
|
||||
|
||||
// GetMaxWait returns value of MaxWait field.
|
||||
func (h *HTTPWaitRequest) GetMaxWait() (value int) {
|
||||
if h == nil {
|
||||
return
|
||||
}
|
||||
return h.MaxWait
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// Message represents TL type `message#5bb8e511`.
|
||||
type Message struct {
|
||||
// MsgID field of Message.
|
||||
MsgID int64
|
||||
// Seqno field of Message.
|
||||
Seqno int
|
||||
// Bytes field of Message.
|
||||
Bytes int
|
||||
// Body field of Message.
|
||||
Body GzipPacked
|
||||
}
|
||||
|
||||
// MessageTypeID is TL type id of Message.
|
||||
const MessageTypeID = 0x5bb8e511
|
||||
|
||||
// Ensuring interfaces in compile-time for Message.
|
||||
var (
|
||||
_ bin.Encoder = &Message{}
|
||||
_ bin.Decoder = &Message{}
|
||||
_ bin.BareEncoder = &Message{}
|
||||
_ bin.BareDecoder = &Message{}
|
||||
)
|
||||
|
||||
func (m *Message) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Seqno == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Bytes == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Body.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *Message) String() string {
|
||||
if m == nil {
|
||||
return "Message(nil)"
|
||||
}
|
||||
type Alias Message
|
||||
return fmt.Sprintf("Message%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Message) TypeID() uint32 {
|
||||
return MessageTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Message) TypeName() string {
|
||||
return "message"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *Message) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "message",
|
||||
ID: MessageTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Seqno",
|
||||
SchemaName: "seqno",
|
||||
},
|
||||
{
|
||||
Name: "Bytes",
|
||||
SchemaName: "bytes",
|
||||
},
|
||||
{
|
||||
Name: "Body",
|
||||
SchemaName: "body",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *Message) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode message#5bb8e511 as nil")
|
||||
}
|
||||
b.PutID(MessageTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *Message) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode message#5bb8e511 as nil")
|
||||
}
|
||||
b.PutLong(m.MsgID)
|
||||
b.PutInt(m.Seqno)
|
||||
b.PutInt(m.Bytes)
|
||||
if err := m.Body.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode message#5bb8e511: field body: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *Message) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode message#5bb8e511 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessageTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode message#5bb8e511: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *Message) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode message#5bb8e511 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#5bb8e511: field msg_id: %w", err)
|
||||
}
|
||||
m.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#5bb8e511: field seqno: %w", err)
|
||||
}
|
||||
m.Seqno = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode message#5bb8e511: field bytes: %w", err)
|
||||
}
|
||||
m.Bytes = value
|
||||
}
|
||||
{
|
||||
if err := m.Body.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode message#5bb8e511: field body: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (m *Message) GetMsgID() (value int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.MsgID
|
||||
}
|
||||
|
||||
// GetSeqno returns value of Seqno field.
|
||||
func (m *Message) GetSeqno() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Seqno
|
||||
}
|
||||
|
||||
// GetBytes returns value of Bytes field.
|
||||
func (m *Message) GetBytes() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Bytes
|
||||
}
|
||||
|
||||
// GetBody returns value of Body field.
|
||||
func (m *Message) GetBody() (value GzipPacked) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Body
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgContainer represents TL type `msg_container#73f1f8dc`.
|
||||
type MsgContainer struct {
|
||||
// Messages field of MsgContainer.
|
||||
Messages []Message
|
||||
}
|
||||
|
||||
// MsgContainerTypeID is TL type id of MsgContainer.
|
||||
const MsgContainerTypeID = 0x73f1f8dc
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgContainer.
|
||||
var (
|
||||
_ bin.Encoder = &MsgContainer{}
|
||||
_ bin.Decoder = &MsgContainer{}
|
||||
_ bin.BareEncoder = &MsgContainer{}
|
||||
_ bin.BareDecoder = &MsgContainer{}
|
||||
)
|
||||
|
||||
func (m *MsgContainer) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.Messages == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgContainer) String() string {
|
||||
if m == nil {
|
||||
return "MsgContainer(nil)"
|
||||
}
|
||||
type Alias MsgContainer
|
||||
return fmt.Sprintf("MsgContainer%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgContainer) TypeID() uint32 {
|
||||
return MsgContainerTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgContainer) TypeName() string {
|
||||
return "msg_container"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgContainer) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msg_container",
|
||||
ID: MsgContainerTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Messages",
|
||||
SchemaName: "messages",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgContainer) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_container#73f1f8dc as nil")
|
||||
}
|
||||
b.PutID(MsgContainerTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgContainer) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_container#73f1f8dc as nil")
|
||||
}
|
||||
b.PutInt(len(m.Messages))
|
||||
for idx, v := range m.Messages {
|
||||
if err := v.EncodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to encode bare msg_container#73f1f8dc: field messages element with index %d: %w", idx, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgContainer) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_container#73f1f8dc to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgContainerTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msg_container#73f1f8dc: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgContainer) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_container#73f1f8dc to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_container#73f1f8dc: field messages: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
m.Messages = make([]Message, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
var value Message
|
||||
if err := value.DecodeBare(b); err != nil {
|
||||
return fmt.Errorf("unable to decode bare msg_container#73f1f8dc: field messages: %w", err)
|
||||
}
|
||||
m.Messages = append(m.Messages, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMessages returns value of Messages field.
|
||||
func (m *MsgContainer) GetMessages() (value []Message) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Messages
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgCopy represents TL type `msg_copy#e06046b2`.
|
||||
type MsgCopy struct {
|
||||
// OrigMessage field of MsgCopy.
|
||||
OrigMessage Message
|
||||
}
|
||||
|
||||
// MsgCopyTypeID is TL type id of MsgCopy.
|
||||
const MsgCopyTypeID = 0xe06046b2
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgCopy.
|
||||
var (
|
||||
_ bin.Encoder = &MsgCopy{}
|
||||
_ bin.Decoder = &MsgCopy{}
|
||||
_ bin.BareEncoder = &MsgCopy{}
|
||||
_ bin.BareDecoder = &MsgCopy{}
|
||||
)
|
||||
|
||||
func (m *MsgCopy) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.OrigMessage.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgCopy) String() string {
|
||||
if m == nil {
|
||||
return "MsgCopy(nil)"
|
||||
}
|
||||
type Alias MsgCopy
|
||||
return fmt.Sprintf("MsgCopy%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgCopy) TypeID() uint32 {
|
||||
return MsgCopyTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgCopy) TypeName() string {
|
||||
return "msg_copy"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgCopy) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msg_copy",
|
||||
ID: MsgCopyTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "OrigMessage",
|
||||
SchemaName: "orig_message",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgCopy) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_copy#e06046b2 as nil")
|
||||
}
|
||||
b.PutID(MsgCopyTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgCopy) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_copy#e06046b2 as nil")
|
||||
}
|
||||
if err := m.OrigMessage.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode msg_copy#e06046b2: field orig_message: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgCopy) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_copy#e06046b2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgCopyTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msg_copy#e06046b2: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgCopy) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_copy#e06046b2 to nil")
|
||||
}
|
||||
{
|
||||
if err := m.OrigMessage.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode msg_copy#e06046b2: field orig_message: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOrigMessage returns value of OrigMessage field.
|
||||
func (m *MsgCopy) GetOrigMessage() (value Message) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.OrigMessage
|
||||
}
|
||||
@@ -0,0 +1,501 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgDetailedInfo represents TL type `msg_detailed_info#276d3ec6`.
|
||||
type MsgDetailedInfo struct {
|
||||
// MsgID field of MsgDetailedInfo.
|
||||
MsgID int64
|
||||
// AnswerMsgID field of MsgDetailedInfo.
|
||||
AnswerMsgID int64
|
||||
// Bytes field of MsgDetailedInfo.
|
||||
Bytes int
|
||||
// Status field of MsgDetailedInfo.
|
||||
Status int
|
||||
}
|
||||
|
||||
// MsgDetailedInfoTypeID is TL type id of MsgDetailedInfo.
|
||||
const MsgDetailedInfoTypeID = 0x276d3ec6
|
||||
|
||||
// construct implements constructor of MsgDetailedInfoClass.
|
||||
func (m MsgDetailedInfo) construct() MsgDetailedInfoClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgDetailedInfo.
|
||||
var (
|
||||
_ bin.Encoder = &MsgDetailedInfo{}
|
||||
_ bin.Decoder = &MsgDetailedInfo{}
|
||||
_ bin.BareEncoder = &MsgDetailedInfo{}
|
||||
_ bin.BareDecoder = &MsgDetailedInfo{}
|
||||
|
||||
_ MsgDetailedInfoClass = &MsgDetailedInfo{}
|
||||
)
|
||||
|
||||
func (m *MsgDetailedInfo) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.AnswerMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Bytes == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Status == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgDetailedInfo) String() string {
|
||||
if m == nil {
|
||||
return "MsgDetailedInfo(nil)"
|
||||
}
|
||||
type Alias MsgDetailedInfo
|
||||
return fmt.Sprintf("MsgDetailedInfo%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgDetailedInfo) TypeID() uint32 {
|
||||
return MsgDetailedInfoTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgDetailedInfo) TypeName() string {
|
||||
return "msg_detailed_info"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgDetailedInfo) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msg_detailed_info",
|
||||
ID: MsgDetailedInfoTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "AnswerMsgID",
|
||||
SchemaName: "answer_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Bytes",
|
||||
SchemaName: "bytes",
|
||||
},
|
||||
{
|
||||
Name: "Status",
|
||||
SchemaName: "status",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgDetailedInfo) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_detailed_info#276d3ec6 as nil")
|
||||
}
|
||||
b.PutID(MsgDetailedInfoTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgDetailedInfo) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_detailed_info#276d3ec6 as nil")
|
||||
}
|
||||
b.PutLong(m.MsgID)
|
||||
b.PutLong(m.AnswerMsgID)
|
||||
b.PutInt(m.Bytes)
|
||||
b.PutInt(m.Status)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgDetailedInfo) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_detailed_info#276d3ec6 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgDetailedInfoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgDetailedInfo) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_detailed_info#276d3ec6 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field msg_id: %w", err)
|
||||
}
|
||||
m.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field answer_msg_id: %w", err)
|
||||
}
|
||||
m.AnswerMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field bytes: %w", err)
|
||||
}
|
||||
m.Bytes = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field status: %w", err)
|
||||
}
|
||||
m.Status = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (m *MsgDetailedInfo) GetMsgID() (value int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.MsgID
|
||||
}
|
||||
|
||||
// GetAnswerMsgID returns value of AnswerMsgID field.
|
||||
func (m *MsgDetailedInfo) GetAnswerMsgID() (value int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.AnswerMsgID
|
||||
}
|
||||
|
||||
// GetBytes returns value of Bytes field.
|
||||
func (m *MsgDetailedInfo) GetBytes() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Bytes
|
||||
}
|
||||
|
||||
// GetStatus returns value of Status field.
|
||||
func (m *MsgDetailedInfo) GetStatus() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Status
|
||||
}
|
||||
|
||||
// MsgNewDetailedInfo represents TL type `msg_new_detailed_info#809db6df`.
|
||||
type MsgNewDetailedInfo struct {
|
||||
// AnswerMsgID field of MsgNewDetailedInfo.
|
||||
AnswerMsgID int64
|
||||
// Bytes field of MsgNewDetailedInfo.
|
||||
Bytes int
|
||||
// Status field of MsgNewDetailedInfo.
|
||||
Status int
|
||||
}
|
||||
|
||||
// MsgNewDetailedInfoTypeID is TL type id of MsgNewDetailedInfo.
|
||||
const MsgNewDetailedInfoTypeID = 0x809db6df
|
||||
|
||||
// construct implements constructor of MsgDetailedInfoClass.
|
||||
func (m MsgNewDetailedInfo) construct() MsgDetailedInfoClass { return &m }
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgNewDetailedInfo.
|
||||
var (
|
||||
_ bin.Encoder = &MsgNewDetailedInfo{}
|
||||
_ bin.Decoder = &MsgNewDetailedInfo{}
|
||||
_ bin.BareEncoder = &MsgNewDetailedInfo{}
|
||||
_ bin.BareDecoder = &MsgNewDetailedInfo{}
|
||||
|
||||
_ MsgDetailedInfoClass = &MsgNewDetailedInfo{}
|
||||
)
|
||||
|
||||
func (m *MsgNewDetailedInfo) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.AnswerMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Bytes == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Status == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgNewDetailedInfo) String() string {
|
||||
if m == nil {
|
||||
return "MsgNewDetailedInfo(nil)"
|
||||
}
|
||||
type Alias MsgNewDetailedInfo
|
||||
return fmt.Sprintf("MsgNewDetailedInfo%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgNewDetailedInfo) TypeID() uint32 {
|
||||
return MsgNewDetailedInfoTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgNewDetailedInfo) TypeName() string {
|
||||
return "msg_new_detailed_info"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgNewDetailedInfo) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msg_new_detailed_info",
|
||||
ID: MsgNewDetailedInfoTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "AnswerMsgID",
|
||||
SchemaName: "answer_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Bytes",
|
||||
SchemaName: "bytes",
|
||||
},
|
||||
{
|
||||
Name: "Status",
|
||||
SchemaName: "status",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgNewDetailedInfo) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_new_detailed_info#809db6df as nil")
|
||||
}
|
||||
b.PutID(MsgNewDetailedInfoTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgNewDetailedInfo) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_new_detailed_info#809db6df as nil")
|
||||
}
|
||||
b.PutLong(m.AnswerMsgID)
|
||||
b.PutInt(m.Bytes)
|
||||
b.PutInt(m.Status)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgNewDetailedInfo) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_new_detailed_info#809db6df to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgNewDetailedInfoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgNewDetailedInfo) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_new_detailed_info#809db6df to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: field answer_msg_id: %w", err)
|
||||
}
|
||||
m.AnswerMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: field bytes: %w", err)
|
||||
}
|
||||
m.Bytes = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: field status: %w", err)
|
||||
}
|
||||
m.Status = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAnswerMsgID returns value of AnswerMsgID field.
|
||||
func (m *MsgNewDetailedInfo) GetAnswerMsgID() (value int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.AnswerMsgID
|
||||
}
|
||||
|
||||
// GetBytes returns value of Bytes field.
|
||||
func (m *MsgNewDetailedInfo) GetBytes() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Bytes
|
||||
}
|
||||
|
||||
// GetStatus returns value of Status field.
|
||||
func (m *MsgNewDetailedInfo) GetStatus() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Status
|
||||
}
|
||||
|
||||
// MsgDetailedInfoClassName is schema name of MsgDetailedInfoClass.
|
||||
const MsgDetailedInfoClassName = "MsgDetailedInfo"
|
||||
|
||||
// MsgDetailedInfoClass represents MsgDetailedInfo generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodeMsgDetailedInfo(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.MsgDetailedInfo: // msg_detailed_info#276d3ec6
|
||||
// case *mt.MsgNewDetailedInfo: // msg_new_detailed_info#809db6df
|
||||
// default: panic(v)
|
||||
// }
|
||||
type MsgDetailedInfoClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() MsgDetailedInfoClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// AnswerMsgID field of MsgDetailedInfo.
|
||||
GetAnswerMsgID() (value int64)
|
||||
// Bytes field of MsgDetailedInfo.
|
||||
GetBytes() (value int)
|
||||
// Status field of MsgDetailedInfo.
|
||||
GetStatus() (value int)
|
||||
}
|
||||
|
||||
// DecodeMsgDetailedInfo implements binary de-serialization for MsgDetailedInfoClass.
|
||||
func DecodeMsgDetailedInfo(buf *bin.Buffer) (MsgDetailedInfoClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case MsgDetailedInfoTypeID:
|
||||
// Decoding msg_detailed_info#276d3ec6.
|
||||
v := MsgDetailedInfo{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MsgDetailedInfoClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case MsgNewDetailedInfoTypeID:
|
||||
// Decoding msg_new_detailed_info#809db6df.
|
||||
v := MsgNewDetailedInfo{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode MsgDetailedInfoClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode MsgDetailedInfoClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// MsgDetailedInfo boxes the MsgDetailedInfoClass providing a helper.
|
||||
type MsgDetailedInfoBox struct {
|
||||
MsgDetailedInfo MsgDetailedInfoClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for MsgDetailedInfoBox.
|
||||
func (b *MsgDetailedInfoBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode MsgDetailedInfoBox to nil")
|
||||
}
|
||||
v, err := DecodeMsgDetailedInfo(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.MsgDetailedInfo = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for MsgDetailedInfoBox.
|
||||
func (b *MsgDetailedInfoBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.MsgDetailedInfo == nil {
|
||||
return fmt.Errorf("unable to encode MsgDetailedInfoClass as nil")
|
||||
}
|
||||
return b.MsgDetailedInfo.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgResendReq represents TL type `msg_resend_req#7d861a08`.
|
||||
type MsgResendReq struct {
|
||||
// MsgIDs field of MsgResendReq.
|
||||
MsgIDs []int64
|
||||
}
|
||||
|
||||
// MsgResendReqTypeID is TL type id of MsgResendReq.
|
||||
const MsgResendReqTypeID = 0x7d861a08
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgResendReq.
|
||||
var (
|
||||
_ bin.Encoder = &MsgResendReq{}
|
||||
_ bin.Decoder = &MsgResendReq{}
|
||||
_ bin.BareEncoder = &MsgResendReq{}
|
||||
_ bin.BareDecoder = &MsgResendReq{}
|
||||
)
|
||||
|
||||
func (m *MsgResendReq) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.MsgIDs == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgResendReq) String() string {
|
||||
if m == nil {
|
||||
return "MsgResendReq(nil)"
|
||||
}
|
||||
type Alias MsgResendReq
|
||||
return fmt.Sprintf("MsgResendReq%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgResendReq) TypeID() uint32 {
|
||||
return MsgResendReqTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgResendReq) TypeName() string {
|
||||
return "msg_resend_req"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgResendReq) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msg_resend_req",
|
||||
ID: MsgResendReqTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgIDs",
|
||||
SchemaName: "msg_ids",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgResendReq) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_resend_req#7d861a08 as nil")
|
||||
}
|
||||
b.PutID(MsgResendReqTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgResendReq) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msg_resend_req#7d861a08 as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(m.MsgIDs))
|
||||
for _, v := range m.MsgIDs {
|
||||
b.PutLong(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgResendReq) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_resend_req#7d861a08 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgResendReqTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msg_resend_req#7d861a08: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgResendReq) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msg_resend_req#7d861a08 to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_resend_req#7d861a08: field msg_ids: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
m.MsgIDs = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msg_resend_req#7d861a08: field msg_ids: %w", err)
|
||||
}
|
||||
m.MsgIDs = append(m.MsgIDs, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgIDs returns value of MsgIDs field.
|
||||
func (m *MsgResendReq) GetMsgIDs() (value []int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.MsgIDs
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgsAck represents TL type `msgs_ack#62d6b459`.
|
||||
type MsgsAck struct {
|
||||
// MsgIDs field of MsgsAck.
|
||||
MsgIDs []int64
|
||||
}
|
||||
|
||||
// MsgsAckTypeID is TL type id of MsgsAck.
|
||||
const MsgsAckTypeID = 0x62d6b459
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgsAck.
|
||||
var (
|
||||
_ bin.Encoder = &MsgsAck{}
|
||||
_ bin.Decoder = &MsgsAck{}
|
||||
_ bin.BareEncoder = &MsgsAck{}
|
||||
_ bin.BareDecoder = &MsgsAck{}
|
||||
)
|
||||
|
||||
func (m *MsgsAck) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.MsgIDs == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgsAck) String() string {
|
||||
if m == nil {
|
||||
return "MsgsAck(nil)"
|
||||
}
|
||||
type Alias MsgsAck
|
||||
return fmt.Sprintf("MsgsAck%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgsAck) TypeID() uint32 {
|
||||
return MsgsAckTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgsAck) TypeName() string {
|
||||
return "msgs_ack"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgsAck) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msgs_ack",
|
||||
ID: MsgsAckTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgIDs",
|
||||
SchemaName: "msg_ids",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgsAck) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_ack#62d6b459 as nil")
|
||||
}
|
||||
b.PutID(MsgsAckTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgsAck) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_ack#62d6b459 as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(m.MsgIDs))
|
||||
for _, v := range m.MsgIDs {
|
||||
b.PutLong(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgsAck) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_ack#62d6b459 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgsAckTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_ack#62d6b459: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgsAck) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_ack#62d6b459 to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_ack#62d6b459: field msg_ids: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
m.MsgIDs = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_ack#62d6b459: field msg_ids: %w", err)
|
||||
}
|
||||
m.MsgIDs = append(m.MsgIDs, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgIDs returns value of MsgIDs field.
|
||||
func (m *MsgsAck) GetMsgIDs() (value []int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.MsgIDs
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgsAllInfo represents TL type `msgs_all_info#8cc0d131`.
|
||||
type MsgsAllInfo struct {
|
||||
// MsgIDs field of MsgsAllInfo.
|
||||
MsgIDs []int64
|
||||
// Info field of MsgsAllInfo.
|
||||
Info []byte
|
||||
}
|
||||
|
||||
// MsgsAllInfoTypeID is TL type id of MsgsAllInfo.
|
||||
const MsgsAllInfoTypeID = 0x8cc0d131
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgsAllInfo.
|
||||
var (
|
||||
_ bin.Encoder = &MsgsAllInfo{}
|
||||
_ bin.Decoder = &MsgsAllInfo{}
|
||||
_ bin.BareEncoder = &MsgsAllInfo{}
|
||||
_ bin.BareDecoder = &MsgsAllInfo{}
|
||||
)
|
||||
|
||||
func (m *MsgsAllInfo) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.MsgIDs == nil) {
|
||||
return false
|
||||
}
|
||||
if !(m.Info == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgsAllInfo) String() string {
|
||||
if m == nil {
|
||||
return "MsgsAllInfo(nil)"
|
||||
}
|
||||
type Alias MsgsAllInfo
|
||||
return fmt.Sprintf("MsgsAllInfo%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgsAllInfo) TypeID() uint32 {
|
||||
return MsgsAllInfoTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgsAllInfo) TypeName() string {
|
||||
return "msgs_all_info"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgsAllInfo) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msgs_all_info",
|
||||
ID: MsgsAllInfoTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgIDs",
|
||||
SchemaName: "msg_ids",
|
||||
},
|
||||
{
|
||||
Name: "Info",
|
||||
SchemaName: "info",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgsAllInfo) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_all_info#8cc0d131 as nil")
|
||||
}
|
||||
b.PutID(MsgsAllInfoTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgsAllInfo) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_all_info#8cc0d131 as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(m.MsgIDs))
|
||||
for _, v := range m.MsgIDs {
|
||||
b.PutLong(v)
|
||||
}
|
||||
b.PutBytes(m.Info)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgsAllInfo) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_all_info#8cc0d131 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgsAllInfoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_all_info#8cc0d131: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgsAllInfo) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_all_info#8cc0d131 to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_all_info#8cc0d131: field msg_ids: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
m.MsgIDs = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_all_info#8cc0d131: field msg_ids: %w", err)
|
||||
}
|
||||
m.MsgIDs = append(m.MsgIDs, value)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_all_info#8cc0d131: field info: %w", err)
|
||||
}
|
||||
m.Info = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgIDs returns value of MsgIDs field.
|
||||
func (m *MsgsAllInfo) GetMsgIDs() (value []int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.MsgIDs
|
||||
}
|
||||
|
||||
// GetInfo returns value of Info field.
|
||||
func (m *MsgsAllInfo) GetInfo() (value []byte) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Info
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgsStateInfo represents TL type `msgs_state_info#4deb57d`.
|
||||
type MsgsStateInfo struct {
|
||||
// ReqMsgID field of MsgsStateInfo.
|
||||
ReqMsgID int64
|
||||
// Info field of MsgsStateInfo.
|
||||
Info []byte
|
||||
}
|
||||
|
||||
// MsgsStateInfoTypeID is TL type id of MsgsStateInfo.
|
||||
const MsgsStateInfoTypeID = 0x4deb57d
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgsStateInfo.
|
||||
var (
|
||||
_ bin.Encoder = &MsgsStateInfo{}
|
||||
_ bin.Decoder = &MsgsStateInfo{}
|
||||
_ bin.BareEncoder = &MsgsStateInfo{}
|
||||
_ bin.BareDecoder = &MsgsStateInfo{}
|
||||
)
|
||||
|
||||
func (m *MsgsStateInfo) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.ReqMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Info == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgsStateInfo) String() string {
|
||||
if m == nil {
|
||||
return "MsgsStateInfo(nil)"
|
||||
}
|
||||
type Alias MsgsStateInfo
|
||||
return fmt.Sprintf("MsgsStateInfo%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgsStateInfo) TypeID() uint32 {
|
||||
return MsgsStateInfoTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgsStateInfo) TypeName() string {
|
||||
return "msgs_state_info"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgsStateInfo) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msgs_state_info",
|
||||
ID: MsgsStateInfoTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ReqMsgID",
|
||||
SchemaName: "req_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Info",
|
||||
SchemaName: "info",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgsStateInfo) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_state_info#4deb57d as nil")
|
||||
}
|
||||
b.PutID(MsgsStateInfoTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgsStateInfo) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_state_info#4deb57d as nil")
|
||||
}
|
||||
b.PutLong(m.ReqMsgID)
|
||||
b.PutBytes(m.Info)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgsStateInfo) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_state_info#4deb57d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgsStateInfoTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_state_info#4deb57d: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgsStateInfo) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_state_info#4deb57d to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_state_info#4deb57d: field req_msg_id: %w", err)
|
||||
}
|
||||
m.ReqMsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_state_info#4deb57d: field info: %w", err)
|
||||
}
|
||||
m.Info = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetReqMsgID returns value of ReqMsgID field.
|
||||
func (m *MsgsStateInfo) GetReqMsgID() (value int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.ReqMsgID
|
||||
}
|
||||
|
||||
// GetInfo returns value of Info field.
|
||||
func (m *MsgsStateInfo) GetInfo() (value []byte) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Info
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MsgsStateReq represents TL type `msgs_state_req#da69fb52`.
|
||||
type MsgsStateReq struct {
|
||||
// MsgIDs field of MsgsStateReq.
|
||||
MsgIDs []int64
|
||||
}
|
||||
|
||||
// MsgsStateReqTypeID is TL type id of MsgsStateReq.
|
||||
const MsgsStateReqTypeID = 0xda69fb52
|
||||
|
||||
// Ensuring interfaces in compile-time for MsgsStateReq.
|
||||
var (
|
||||
_ bin.Encoder = &MsgsStateReq{}
|
||||
_ bin.Decoder = &MsgsStateReq{}
|
||||
_ bin.BareEncoder = &MsgsStateReq{}
|
||||
_ bin.BareDecoder = &MsgsStateReq{}
|
||||
)
|
||||
|
||||
func (m *MsgsStateReq) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.MsgIDs == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MsgsStateReq) String() string {
|
||||
if m == nil {
|
||||
return "MsgsStateReq(nil)"
|
||||
}
|
||||
type Alias MsgsStateReq
|
||||
return fmt.Sprintf("MsgsStateReq%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MsgsStateReq) TypeID() uint32 {
|
||||
return MsgsStateReqTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MsgsStateReq) TypeName() string {
|
||||
return "msgs_state_req"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MsgsStateReq) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "msgs_state_req",
|
||||
ID: MsgsStateReqTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgIDs",
|
||||
SchemaName: "msg_ids",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MsgsStateReq) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_state_req#da69fb52 as nil")
|
||||
}
|
||||
b.PutID(MsgsStateReqTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MsgsStateReq) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode msgs_state_req#da69fb52 as nil")
|
||||
}
|
||||
b.PutVectorHeader(len(m.MsgIDs))
|
||||
for _, v := range m.MsgIDs {
|
||||
b.PutLong(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MsgsStateReq) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_state_req#da69fb52 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MsgsStateReqTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_state_req#da69fb52: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MsgsStateReq) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode msgs_state_req#da69fb52 to nil")
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_state_req#da69fb52: field msg_ids: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
m.MsgIDs = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode msgs_state_req#da69fb52: field msg_ids: %w", err)
|
||||
}
|
||||
m.MsgIDs = append(m.MsgIDs, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgIDs returns value of MsgIDs field.
|
||||
func (m *MsgsStateReq) GetMsgIDs() (value []int64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.MsgIDs
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
@@ -0,0 +1,965 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PQInnerData represents TL type `p_q_inner_data#83c95aec`.
|
||||
type PQInnerData struct {
|
||||
// Pq field of PQInnerData.
|
||||
Pq []byte
|
||||
// P field of PQInnerData.
|
||||
P []byte
|
||||
// Q field of PQInnerData.
|
||||
Q []byte
|
||||
// Nonce field of PQInnerData.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of PQInnerData.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonce field of PQInnerData.
|
||||
NewNonce bin.Int256
|
||||
}
|
||||
|
||||
// PQInnerDataTypeID is TL type id of PQInnerData.
|
||||
const PQInnerDataTypeID = 0x83c95aec
|
||||
|
||||
// construct implements constructor of PQInnerDataClass.
|
||||
func (p PQInnerData) construct() PQInnerDataClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PQInnerData.
|
||||
var (
|
||||
_ bin.Encoder = &PQInnerData{}
|
||||
_ bin.Decoder = &PQInnerData{}
|
||||
_ bin.BareEncoder = &PQInnerData{}
|
||||
_ bin.BareDecoder = &PQInnerData{}
|
||||
|
||||
_ PQInnerDataClass = &PQInnerData{}
|
||||
)
|
||||
|
||||
func (p *PQInnerData) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Pq == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.P == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Q == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.NewNonce == bin.Int256{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PQInnerData) String() string {
|
||||
if p == nil {
|
||||
return "PQInnerData(nil)"
|
||||
}
|
||||
type Alias PQInnerData
|
||||
return fmt.Sprintf("PQInnerData%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PQInnerData) TypeID() uint32 {
|
||||
return PQInnerDataTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PQInnerData) TypeName() string {
|
||||
return "p_q_inner_data"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PQInnerData) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "p_q_inner_data",
|
||||
ID: PQInnerDataTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Pq",
|
||||
SchemaName: "pq",
|
||||
},
|
||||
{
|
||||
Name: "P",
|
||||
SchemaName: "p",
|
||||
},
|
||||
{
|
||||
Name: "Q",
|
||||
SchemaName: "q",
|
||||
},
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonce",
|
||||
SchemaName: "new_nonce",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PQInnerData) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode p_q_inner_data#83c95aec as nil")
|
||||
}
|
||||
b.PutID(PQInnerDataTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PQInnerData) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode p_q_inner_data#83c95aec as nil")
|
||||
}
|
||||
b.PutBytes(p.Pq)
|
||||
b.PutBytes(p.P)
|
||||
b.PutBytes(p.Q)
|
||||
b.PutInt128(p.Nonce)
|
||||
b.PutInt128(p.ServerNonce)
|
||||
b.PutInt256(p.NewNonce)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PQInnerData) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode p_q_inner_data#83c95aec to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PQInnerDataTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PQInnerData) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode p_q_inner_data#83c95aec to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: field pq: %w", err)
|
||||
}
|
||||
p.Pq = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: field p: %w", err)
|
||||
}
|
||||
p.P = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: field q: %w", err)
|
||||
}
|
||||
p.Q = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: field nonce: %w", err)
|
||||
}
|
||||
p.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: field server_nonce: %w", err)
|
||||
}
|
||||
p.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int256()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data#83c95aec: field new_nonce: %w", err)
|
||||
}
|
||||
p.NewNonce = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPq returns value of Pq field.
|
||||
func (p *PQInnerData) GetPq() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Pq
|
||||
}
|
||||
|
||||
// GetP returns value of P field.
|
||||
func (p *PQInnerData) GetP() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.P
|
||||
}
|
||||
|
||||
// GetQ returns value of Q field.
|
||||
func (p *PQInnerData) GetQ() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Q
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (p *PQInnerData) GetNonce() (value bin.Int128) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (p *PQInnerData) GetServerNonce() (value bin.Int128) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonce returns value of NewNonce field.
|
||||
func (p *PQInnerData) GetNewNonce() (value bin.Int256) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.NewNonce
|
||||
}
|
||||
|
||||
// PQInnerDataDC represents TL type `p_q_inner_data_dc#a9f55f95`.
|
||||
type PQInnerDataDC struct {
|
||||
// Pq field of PQInnerDataDC.
|
||||
Pq []byte
|
||||
// P field of PQInnerDataDC.
|
||||
P []byte
|
||||
// Q field of PQInnerDataDC.
|
||||
Q []byte
|
||||
// Nonce field of PQInnerDataDC.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of PQInnerDataDC.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonce field of PQInnerDataDC.
|
||||
NewNonce bin.Int256
|
||||
// DC field of PQInnerDataDC.
|
||||
DC int
|
||||
}
|
||||
|
||||
// PQInnerDataDCTypeID is TL type id of PQInnerDataDC.
|
||||
const PQInnerDataDCTypeID = 0xa9f55f95
|
||||
|
||||
// construct implements constructor of PQInnerDataClass.
|
||||
func (p PQInnerDataDC) construct() PQInnerDataClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PQInnerDataDC.
|
||||
var (
|
||||
_ bin.Encoder = &PQInnerDataDC{}
|
||||
_ bin.Decoder = &PQInnerDataDC{}
|
||||
_ bin.BareEncoder = &PQInnerDataDC{}
|
||||
_ bin.BareDecoder = &PQInnerDataDC{}
|
||||
|
||||
_ PQInnerDataClass = &PQInnerDataDC{}
|
||||
)
|
||||
|
||||
func (p *PQInnerDataDC) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Pq == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.P == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Q == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.NewNonce == bin.Int256{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.DC == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PQInnerDataDC) String() string {
|
||||
if p == nil {
|
||||
return "PQInnerDataDC(nil)"
|
||||
}
|
||||
type Alias PQInnerDataDC
|
||||
return fmt.Sprintf("PQInnerDataDC%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PQInnerDataDC) TypeID() uint32 {
|
||||
return PQInnerDataDCTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PQInnerDataDC) TypeName() string {
|
||||
return "p_q_inner_data_dc"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PQInnerDataDC) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "p_q_inner_data_dc",
|
||||
ID: PQInnerDataDCTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Pq",
|
||||
SchemaName: "pq",
|
||||
},
|
||||
{
|
||||
Name: "P",
|
||||
SchemaName: "p",
|
||||
},
|
||||
{
|
||||
Name: "Q",
|
||||
SchemaName: "q",
|
||||
},
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonce",
|
||||
SchemaName: "new_nonce",
|
||||
},
|
||||
{
|
||||
Name: "DC",
|
||||
SchemaName: "dc",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PQInnerDataDC) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode p_q_inner_data_dc#a9f55f95 as nil")
|
||||
}
|
||||
b.PutID(PQInnerDataDCTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PQInnerDataDC) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode p_q_inner_data_dc#a9f55f95 as nil")
|
||||
}
|
||||
b.PutBytes(p.Pq)
|
||||
b.PutBytes(p.P)
|
||||
b.PutBytes(p.Q)
|
||||
b.PutInt128(p.Nonce)
|
||||
b.PutInt128(p.ServerNonce)
|
||||
b.PutInt256(p.NewNonce)
|
||||
b.PutInt(p.DC)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PQInnerDataDC) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode p_q_inner_data_dc#a9f55f95 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PQInnerDataDCTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PQInnerDataDC) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode p_q_inner_data_dc#a9f55f95 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field pq: %w", err)
|
||||
}
|
||||
p.Pq = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field p: %w", err)
|
||||
}
|
||||
p.P = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field q: %w", err)
|
||||
}
|
||||
p.Q = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field nonce: %w", err)
|
||||
}
|
||||
p.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field server_nonce: %w", err)
|
||||
}
|
||||
p.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int256()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field new_nonce: %w", err)
|
||||
}
|
||||
p.NewNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_dc#a9f55f95: field dc: %w", err)
|
||||
}
|
||||
p.DC = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPq returns value of Pq field.
|
||||
func (p *PQInnerDataDC) GetPq() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Pq
|
||||
}
|
||||
|
||||
// GetP returns value of P field.
|
||||
func (p *PQInnerDataDC) GetP() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.P
|
||||
}
|
||||
|
||||
// GetQ returns value of Q field.
|
||||
func (p *PQInnerDataDC) GetQ() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Q
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (p *PQInnerDataDC) GetNonce() (value bin.Int128) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (p *PQInnerDataDC) GetServerNonce() (value bin.Int128) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonce returns value of NewNonce field.
|
||||
func (p *PQInnerDataDC) GetNewNonce() (value bin.Int256) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.NewNonce
|
||||
}
|
||||
|
||||
// GetDC returns value of DC field.
|
||||
func (p *PQInnerDataDC) GetDC() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.DC
|
||||
}
|
||||
|
||||
// PQInnerDataTempDC represents TL type `p_q_inner_data_temp_dc#56fddf88`.
|
||||
type PQInnerDataTempDC struct {
|
||||
// Pq field of PQInnerDataTempDC.
|
||||
Pq []byte
|
||||
// P field of PQInnerDataTempDC.
|
||||
P []byte
|
||||
// Q field of PQInnerDataTempDC.
|
||||
Q []byte
|
||||
// Nonce field of PQInnerDataTempDC.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of PQInnerDataTempDC.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonce field of PQInnerDataTempDC.
|
||||
NewNonce bin.Int256
|
||||
// DC field of PQInnerDataTempDC.
|
||||
DC int
|
||||
// ExpiresIn field of PQInnerDataTempDC.
|
||||
ExpiresIn int
|
||||
}
|
||||
|
||||
// PQInnerDataTempDCTypeID is TL type id of PQInnerDataTempDC.
|
||||
const PQInnerDataTempDCTypeID = 0x56fddf88
|
||||
|
||||
// construct implements constructor of PQInnerDataClass.
|
||||
func (p PQInnerDataTempDC) construct() PQInnerDataClass { return &p }
|
||||
|
||||
// Ensuring interfaces in compile-time for PQInnerDataTempDC.
|
||||
var (
|
||||
_ bin.Encoder = &PQInnerDataTempDC{}
|
||||
_ bin.Decoder = &PQInnerDataTempDC{}
|
||||
_ bin.BareEncoder = &PQInnerDataTempDC{}
|
||||
_ bin.BareDecoder = &PQInnerDataTempDC{}
|
||||
|
||||
_ PQInnerDataClass = &PQInnerDataTempDC{}
|
||||
)
|
||||
|
||||
func (p *PQInnerDataTempDC) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.Pq == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.P == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Q == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.NewNonce == bin.Int256{}) {
|
||||
return false
|
||||
}
|
||||
if !(p.DC == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.ExpiresIn == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PQInnerDataTempDC) String() string {
|
||||
if p == nil {
|
||||
return "PQInnerDataTempDC(nil)"
|
||||
}
|
||||
type Alias PQInnerDataTempDC
|
||||
return fmt.Sprintf("PQInnerDataTempDC%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PQInnerDataTempDC) TypeID() uint32 {
|
||||
return PQInnerDataTempDCTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PQInnerDataTempDC) TypeName() string {
|
||||
return "p_q_inner_data_temp_dc"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PQInnerDataTempDC) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "p_q_inner_data_temp_dc",
|
||||
ID: PQInnerDataTempDCTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Pq",
|
||||
SchemaName: "pq",
|
||||
},
|
||||
{
|
||||
Name: "P",
|
||||
SchemaName: "p",
|
||||
},
|
||||
{
|
||||
Name: "Q",
|
||||
SchemaName: "q",
|
||||
},
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonce",
|
||||
SchemaName: "new_nonce",
|
||||
},
|
||||
{
|
||||
Name: "DC",
|
||||
SchemaName: "dc",
|
||||
},
|
||||
{
|
||||
Name: "ExpiresIn",
|
||||
SchemaName: "expires_in",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PQInnerDataTempDC) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode p_q_inner_data_temp_dc#56fddf88 as nil")
|
||||
}
|
||||
b.PutID(PQInnerDataTempDCTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PQInnerDataTempDC) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode p_q_inner_data_temp_dc#56fddf88 as nil")
|
||||
}
|
||||
b.PutBytes(p.Pq)
|
||||
b.PutBytes(p.P)
|
||||
b.PutBytes(p.Q)
|
||||
b.PutInt128(p.Nonce)
|
||||
b.PutInt128(p.ServerNonce)
|
||||
b.PutInt256(p.NewNonce)
|
||||
b.PutInt(p.DC)
|
||||
b.PutInt(p.ExpiresIn)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PQInnerDataTempDC) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode p_q_inner_data_temp_dc#56fddf88 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PQInnerDataTempDCTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PQInnerDataTempDC) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode p_q_inner_data_temp_dc#56fddf88 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field pq: %w", err)
|
||||
}
|
||||
p.Pq = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field p: %w", err)
|
||||
}
|
||||
p.P = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field q: %w", err)
|
||||
}
|
||||
p.Q = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field nonce: %w", err)
|
||||
}
|
||||
p.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field server_nonce: %w", err)
|
||||
}
|
||||
p.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int256()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field new_nonce: %w", err)
|
||||
}
|
||||
p.NewNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field dc: %w", err)
|
||||
}
|
||||
p.DC = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode p_q_inner_data_temp_dc#56fddf88: field expires_in: %w", err)
|
||||
}
|
||||
p.ExpiresIn = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPq returns value of Pq field.
|
||||
func (p *PQInnerDataTempDC) GetPq() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Pq
|
||||
}
|
||||
|
||||
// GetP returns value of P field.
|
||||
func (p *PQInnerDataTempDC) GetP() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.P
|
||||
}
|
||||
|
||||
// GetQ returns value of Q field.
|
||||
func (p *PQInnerDataTempDC) GetQ() (value []byte) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Q
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (p *PQInnerDataTempDC) GetNonce() (value bin.Int128) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (p *PQInnerDataTempDC) GetServerNonce() (value bin.Int128) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonce returns value of NewNonce field.
|
||||
func (p *PQInnerDataTempDC) GetNewNonce() (value bin.Int256) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.NewNonce
|
||||
}
|
||||
|
||||
// GetDC returns value of DC field.
|
||||
func (p *PQInnerDataTempDC) GetDC() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.DC
|
||||
}
|
||||
|
||||
// GetExpiresIn returns value of ExpiresIn field.
|
||||
func (p *PQInnerDataTempDC) GetExpiresIn() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.ExpiresIn
|
||||
}
|
||||
|
||||
// PQInnerDataClassName is schema name of PQInnerDataClass.
|
||||
const PQInnerDataClassName = "P_Q_inner_data"
|
||||
|
||||
// PQInnerDataClass represents P_Q_inner_data generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodePQInnerData(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.PQInnerData: // p_q_inner_data#83c95aec
|
||||
// case *mt.PQInnerDataDC: // p_q_inner_data_dc#a9f55f95
|
||||
// case *mt.PQInnerDataTempDC: // p_q_inner_data_temp_dc#56fddf88
|
||||
// default: panic(v)
|
||||
// }
|
||||
type PQInnerDataClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() PQInnerDataClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// Pq field of PQInnerData.
|
||||
GetPq() (value []byte)
|
||||
// P field of PQInnerData.
|
||||
GetP() (value []byte)
|
||||
// Q field of PQInnerData.
|
||||
GetQ() (value []byte)
|
||||
// Nonce field of PQInnerData.
|
||||
GetNonce() (value bin.Int128)
|
||||
// ServerNonce field of PQInnerData.
|
||||
GetServerNonce() (value bin.Int128)
|
||||
// NewNonce field of PQInnerData.
|
||||
GetNewNonce() (value bin.Int256)
|
||||
}
|
||||
|
||||
// DecodePQInnerData implements binary de-serialization for PQInnerDataClass.
|
||||
func DecodePQInnerData(buf *bin.Buffer) (PQInnerDataClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case PQInnerDataTypeID:
|
||||
// Decoding p_q_inner_data#83c95aec.
|
||||
v := PQInnerData{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case PQInnerDataDCTypeID:
|
||||
// Decoding p_q_inner_data_dc#a9f55f95.
|
||||
v := PQInnerDataDC{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case PQInnerDataTempDCTypeID:
|
||||
// Decoding p_q_inner_data_temp_dc#56fddf88.
|
||||
v := PQInnerDataTempDC{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode PQInnerDataClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// PQInnerData boxes the PQInnerDataClass providing a helper.
|
||||
type PQInnerDataBox struct {
|
||||
P_Q_inner_data PQInnerDataClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for PQInnerDataBox.
|
||||
func (b *PQInnerDataBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode PQInnerDataBox to nil")
|
||||
}
|
||||
v, err := DecodePQInnerData(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.P_Q_inner_data = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for PQInnerDataBox.
|
||||
func (b *PQInnerDataBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.P_Q_inner_data == nil {
|
||||
return fmt.Errorf("unable to encode PQInnerDataClass as nil")
|
||||
}
|
||||
return b.P_Q_inner_data.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PingDelayDisconnectRequest represents TL type `ping_delay_disconnect#f3427b8c`.
|
||||
type PingDelayDisconnectRequest struct {
|
||||
// PingID field of PingDelayDisconnectRequest.
|
||||
PingID int64
|
||||
// DisconnectDelay field of PingDelayDisconnectRequest.
|
||||
DisconnectDelay int
|
||||
}
|
||||
|
||||
// PingDelayDisconnectRequestTypeID is TL type id of PingDelayDisconnectRequest.
|
||||
const PingDelayDisconnectRequestTypeID = 0xf3427b8c
|
||||
|
||||
// Ensuring interfaces in compile-time for PingDelayDisconnectRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PingDelayDisconnectRequest{}
|
||||
_ bin.Decoder = &PingDelayDisconnectRequest{}
|
||||
_ bin.BareEncoder = &PingDelayDisconnectRequest{}
|
||||
_ bin.BareDecoder = &PingDelayDisconnectRequest{}
|
||||
)
|
||||
|
||||
func (p *PingDelayDisconnectRequest) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.PingID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.DisconnectDelay == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PingDelayDisconnectRequest) String() string {
|
||||
if p == nil {
|
||||
return "PingDelayDisconnectRequest(nil)"
|
||||
}
|
||||
type Alias PingDelayDisconnectRequest
|
||||
return fmt.Sprintf("PingDelayDisconnectRequest%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PingDelayDisconnectRequest) TypeID() uint32 {
|
||||
return PingDelayDisconnectRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PingDelayDisconnectRequest) TypeName() string {
|
||||
return "ping_delay_disconnect"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PingDelayDisconnectRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "ping_delay_disconnect",
|
||||
ID: PingDelayDisconnectRequestTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PingID",
|
||||
SchemaName: "ping_id",
|
||||
},
|
||||
{
|
||||
Name: "DisconnectDelay",
|
||||
SchemaName: "disconnect_delay",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PingDelayDisconnectRequest) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode ping_delay_disconnect#f3427b8c as nil")
|
||||
}
|
||||
b.PutID(PingDelayDisconnectRequestTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PingDelayDisconnectRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode ping_delay_disconnect#f3427b8c as nil")
|
||||
}
|
||||
b.PutLong(p.PingID)
|
||||
b.PutInt(p.DisconnectDelay)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PingDelayDisconnectRequest) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode ping_delay_disconnect#f3427b8c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PingDelayDisconnectRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode ping_delay_disconnect#f3427b8c: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PingDelayDisconnectRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode ping_delay_disconnect#f3427b8c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode ping_delay_disconnect#f3427b8c: field ping_id: %w", err)
|
||||
}
|
||||
p.PingID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode ping_delay_disconnect#f3427b8c: field disconnect_delay: %w", err)
|
||||
}
|
||||
p.DisconnectDelay = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPingID returns value of PingID field.
|
||||
func (p *PingDelayDisconnectRequest) GetPingID() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.PingID
|
||||
}
|
||||
|
||||
// GetDisconnectDelay returns value of DisconnectDelay field.
|
||||
func (p *PingDelayDisconnectRequest) GetDisconnectDelay() (value int) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.DisconnectDelay
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PingRequest represents TL type `ping#7abe77ec`.
|
||||
type PingRequest struct {
|
||||
// PingID field of PingRequest.
|
||||
PingID int64
|
||||
}
|
||||
|
||||
// PingRequestTypeID is TL type id of PingRequest.
|
||||
const PingRequestTypeID = 0x7abe77ec
|
||||
|
||||
// Ensuring interfaces in compile-time for PingRequest.
|
||||
var (
|
||||
_ bin.Encoder = &PingRequest{}
|
||||
_ bin.Decoder = &PingRequest{}
|
||||
_ bin.BareEncoder = &PingRequest{}
|
||||
_ bin.BareDecoder = &PingRequest{}
|
||||
)
|
||||
|
||||
func (p *PingRequest) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.PingID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PingRequest) String() string {
|
||||
if p == nil {
|
||||
return "PingRequest(nil)"
|
||||
}
|
||||
type Alias PingRequest
|
||||
return fmt.Sprintf("PingRequest%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PingRequest) TypeID() uint32 {
|
||||
return PingRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PingRequest) TypeName() string {
|
||||
return "ping"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PingRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "ping",
|
||||
ID: PingRequestTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "PingID",
|
||||
SchemaName: "ping_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PingRequest) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode ping#7abe77ec as nil")
|
||||
}
|
||||
b.PutID(PingRequestTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PingRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode ping#7abe77ec as nil")
|
||||
}
|
||||
b.PutLong(p.PingID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PingRequest) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode ping#7abe77ec to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PingRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode ping#7abe77ec: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PingRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode ping#7abe77ec to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode ping#7abe77ec: field ping_id: %w", err)
|
||||
}
|
||||
p.PingID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPingID returns value of PingID field.
|
||||
func (p *PingRequest) GetPingID() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.PingID
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// Pong represents TL type `pong#347773c5`.
|
||||
type Pong struct {
|
||||
// MsgID field of Pong.
|
||||
MsgID int64
|
||||
// PingID field of Pong.
|
||||
PingID int64
|
||||
}
|
||||
|
||||
// PongTypeID is TL type id of Pong.
|
||||
const PongTypeID = 0x347773c5
|
||||
|
||||
// Ensuring interfaces in compile-time for Pong.
|
||||
var (
|
||||
_ bin.Encoder = &Pong{}
|
||||
_ bin.Decoder = &Pong{}
|
||||
_ bin.BareEncoder = &Pong{}
|
||||
_ bin.BareDecoder = &Pong{}
|
||||
)
|
||||
|
||||
func (p *Pong) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.PingID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *Pong) String() string {
|
||||
if p == nil {
|
||||
return "Pong(nil)"
|
||||
}
|
||||
type Alias Pong
|
||||
return fmt.Sprintf("Pong%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Pong) TypeID() uint32 {
|
||||
return PongTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Pong) TypeName() string {
|
||||
return "pong"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *Pong) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "pong",
|
||||
ID: PongTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "PingID",
|
||||
SchemaName: "ping_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *Pong) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pong#347773c5 as nil")
|
||||
}
|
||||
b.PutID(PongTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *Pong) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pong#347773c5 as nil")
|
||||
}
|
||||
b.PutLong(p.MsgID)
|
||||
b.PutLong(p.PingID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *Pong) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pong#347773c5 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PongTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode pong#347773c5: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *Pong) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pong#347773c5 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pong#347773c5: field msg_id: %w", err)
|
||||
}
|
||||
p.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pong#347773c5: field ping_id: %w", err)
|
||||
}
|
||||
p.PingID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (p *Pong) GetMsgID() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.MsgID
|
||||
}
|
||||
|
||||
// GetPingID returns value of PingID field.
|
||||
func (p *Pong) GetPingID() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.PingID
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// TypesMap returns mapping from type ids to TL type names.
|
||||
func TypesMap() map[uint32]string {
|
||||
return map[uint32]string{
|
||||
ResPQTypeID: "resPQ#5162463",
|
||||
PQInnerDataTypeID: "p_q_inner_data#83c95aec",
|
||||
PQInnerDataDCTypeID: "p_q_inner_data_dc#a9f55f95",
|
||||
PQInnerDataTempDCTypeID: "p_q_inner_data_temp_dc#56fddf88",
|
||||
ServerDHParamsFailTypeID: "server_DH_params_fail#79cb045d",
|
||||
ServerDHParamsOkTypeID: "server_DH_params_ok#d0e8075c",
|
||||
ServerDHInnerDataTypeID: "server_DH_inner_data#b5890dba",
|
||||
ClientDHInnerDataTypeID: "client_DH_inner_data#6643b654",
|
||||
DhGenOkTypeID: "dh_gen_ok#3bcbf734",
|
||||
DhGenRetryTypeID: "dh_gen_retry#46dc1fb9",
|
||||
DhGenFailTypeID: "dh_gen_fail#a69dae02",
|
||||
RPCResultTypeID: "rpc_result#f35c6d01",
|
||||
RPCErrorTypeID: "rpc_error#2144ca19",
|
||||
RPCAnswerUnknownTypeID: "rpc_answer_unknown#5e2ad36e",
|
||||
RPCAnswerDroppedRunningTypeID: "rpc_answer_dropped_running#cd78e586",
|
||||
RPCAnswerDroppedTypeID: "rpc_answer_dropped#a43ad8b7",
|
||||
FutureSaltTypeID: "future_salt#949d9dc",
|
||||
FutureSaltsTypeID: "future_salts#ae500895",
|
||||
PongTypeID: "pong#347773c5",
|
||||
DestroySessionOkTypeID: "destroy_session_ok#e22045fc",
|
||||
DestroySessionNoneTypeID: "destroy_session_none#62d350c9",
|
||||
NewSessionCreatedTypeID: "new_session_created#9ec20908",
|
||||
MsgContainerTypeID: "msg_container#73f1f8dc",
|
||||
MessageTypeID: "message#5bb8e511",
|
||||
MsgCopyTypeID: "msg_copy#e06046b2",
|
||||
GzipPackedTypeID: "gzip_packed#3072cfa1",
|
||||
MsgsAckTypeID: "msgs_ack#62d6b459",
|
||||
BadMsgNotificationTypeID: "bad_msg_notification#a7eff811",
|
||||
BadServerSaltTypeID: "bad_server_salt#edab447b",
|
||||
MsgResendReqTypeID: "msg_resend_req#7d861a08",
|
||||
MsgsStateReqTypeID: "msgs_state_req#da69fb52",
|
||||
MsgsStateInfoTypeID: "msgs_state_info#4deb57d",
|
||||
MsgsAllInfoTypeID: "msgs_all_info#8cc0d131",
|
||||
MsgDetailedInfoTypeID: "msg_detailed_info#276d3ec6",
|
||||
MsgNewDetailedInfoTypeID: "msg_new_detailed_info#809db6df",
|
||||
ReqPqRequestTypeID: "req_pq#60469778",
|
||||
ReqPqMultiRequestTypeID: "req_pq_multi#be7e8ef1",
|
||||
ReqDHParamsRequestTypeID: "req_DH_params#d712e4be",
|
||||
SetClientDHParamsRequestTypeID: "set_client_DH_params#f5045f1f",
|
||||
RPCDropAnswerRequestTypeID: "rpc_drop_answer#58e4a740",
|
||||
GetFutureSaltsRequestTypeID: "get_future_salts#b921bd04",
|
||||
PingRequestTypeID: "ping#7abe77ec",
|
||||
PingDelayDisconnectRequestTypeID: "ping_delay_disconnect#f3427b8c",
|
||||
DestroySessionRequestTypeID: "destroy_session#e7512126",
|
||||
HTTPWaitRequestTypeID: "http_wait#9299359f",
|
||||
}
|
||||
}
|
||||
|
||||
// NamesMap returns mapping from type names to TL type ids.
|
||||
func NamesMap() map[string]uint32 {
|
||||
return map[string]uint32{
|
||||
"resPQ": ResPQTypeID,
|
||||
"p_q_inner_data": PQInnerDataTypeID,
|
||||
"p_q_inner_data_dc": PQInnerDataDCTypeID,
|
||||
"p_q_inner_data_temp_dc": PQInnerDataTempDCTypeID,
|
||||
"server_DH_params_fail": ServerDHParamsFailTypeID,
|
||||
"server_DH_params_ok": ServerDHParamsOkTypeID,
|
||||
"server_DH_inner_data": ServerDHInnerDataTypeID,
|
||||
"client_DH_inner_data": ClientDHInnerDataTypeID,
|
||||
"dh_gen_ok": DhGenOkTypeID,
|
||||
"dh_gen_retry": DhGenRetryTypeID,
|
||||
"dh_gen_fail": DhGenFailTypeID,
|
||||
"rpc_result": RPCResultTypeID,
|
||||
"rpc_error": RPCErrorTypeID,
|
||||
"rpc_answer_unknown": RPCAnswerUnknownTypeID,
|
||||
"rpc_answer_dropped_running": RPCAnswerDroppedRunningTypeID,
|
||||
"rpc_answer_dropped": RPCAnswerDroppedTypeID,
|
||||
"future_salt": FutureSaltTypeID,
|
||||
"future_salts": FutureSaltsTypeID,
|
||||
"pong": PongTypeID,
|
||||
"destroy_session_ok": DestroySessionOkTypeID,
|
||||
"destroy_session_none": DestroySessionNoneTypeID,
|
||||
"new_session_created": NewSessionCreatedTypeID,
|
||||
"msg_container": MsgContainerTypeID,
|
||||
"message": MessageTypeID,
|
||||
"msg_copy": MsgCopyTypeID,
|
||||
"gzip_packed": GzipPackedTypeID,
|
||||
"msgs_ack": MsgsAckTypeID,
|
||||
"bad_msg_notification": BadMsgNotificationTypeID,
|
||||
"bad_server_salt": BadServerSaltTypeID,
|
||||
"msg_resend_req": MsgResendReqTypeID,
|
||||
"msgs_state_req": MsgsStateReqTypeID,
|
||||
"msgs_state_info": MsgsStateInfoTypeID,
|
||||
"msgs_all_info": MsgsAllInfoTypeID,
|
||||
"msg_detailed_info": MsgDetailedInfoTypeID,
|
||||
"msg_new_detailed_info": MsgNewDetailedInfoTypeID,
|
||||
"req_pq": ReqPqRequestTypeID,
|
||||
"req_pq_multi": ReqPqMultiRequestTypeID,
|
||||
"req_DH_params": ReqDHParamsRequestTypeID,
|
||||
"set_client_DH_params": SetClientDHParamsRequestTypeID,
|
||||
"rpc_drop_answer": RPCDropAnswerRequestTypeID,
|
||||
"get_future_salts": GetFutureSaltsRequestTypeID,
|
||||
"ping": PingRequestTypeID,
|
||||
"ping_delay_disconnect": PingDelayDisconnectRequestTypeID,
|
||||
"destroy_session": DestroySessionRequestTypeID,
|
||||
"http_wait": HTTPWaitRequestTypeID,
|
||||
}
|
||||
}
|
||||
|
||||
// TypesConstructorMap maps type ids to constructors.
|
||||
func TypesConstructorMap() map[uint32]func() bin.Object {
|
||||
return map[uint32]func() bin.Object{
|
||||
ResPQTypeID: func() bin.Object { return &ResPQ{} },
|
||||
PQInnerDataTypeID: func() bin.Object { return &PQInnerData{} },
|
||||
PQInnerDataDCTypeID: func() bin.Object { return &PQInnerDataDC{} },
|
||||
PQInnerDataTempDCTypeID: func() bin.Object { return &PQInnerDataTempDC{} },
|
||||
ServerDHParamsFailTypeID: func() bin.Object { return &ServerDHParamsFail{} },
|
||||
ServerDHParamsOkTypeID: func() bin.Object { return &ServerDHParamsOk{} },
|
||||
ServerDHInnerDataTypeID: func() bin.Object { return &ServerDHInnerData{} },
|
||||
ClientDHInnerDataTypeID: func() bin.Object { return &ClientDHInnerData{} },
|
||||
DhGenOkTypeID: func() bin.Object { return &DhGenOk{} },
|
||||
DhGenRetryTypeID: func() bin.Object { return &DhGenRetry{} },
|
||||
DhGenFailTypeID: func() bin.Object { return &DhGenFail{} },
|
||||
RPCResultTypeID: func() bin.Object { return &RPCResult{} },
|
||||
RPCErrorTypeID: func() bin.Object { return &RPCError{} },
|
||||
RPCAnswerUnknownTypeID: func() bin.Object { return &RPCAnswerUnknown{} },
|
||||
RPCAnswerDroppedRunningTypeID: func() bin.Object { return &RPCAnswerDroppedRunning{} },
|
||||
RPCAnswerDroppedTypeID: func() bin.Object { return &RPCAnswerDropped{} },
|
||||
FutureSaltTypeID: func() bin.Object { return &FutureSalt{} },
|
||||
FutureSaltsTypeID: func() bin.Object { return &FutureSalts{} },
|
||||
PongTypeID: func() bin.Object { return &Pong{} },
|
||||
DestroySessionOkTypeID: func() bin.Object { return &DestroySessionOk{} },
|
||||
DestroySessionNoneTypeID: func() bin.Object { return &DestroySessionNone{} },
|
||||
NewSessionCreatedTypeID: func() bin.Object { return &NewSessionCreated{} },
|
||||
MsgContainerTypeID: func() bin.Object { return &MsgContainer{} },
|
||||
MessageTypeID: func() bin.Object { return &Message{} },
|
||||
MsgCopyTypeID: func() bin.Object { return &MsgCopy{} },
|
||||
GzipPackedTypeID: func() bin.Object { return &GzipPacked{} },
|
||||
MsgsAckTypeID: func() bin.Object { return &MsgsAck{} },
|
||||
BadMsgNotificationTypeID: func() bin.Object { return &BadMsgNotification{} },
|
||||
BadServerSaltTypeID: func() bin.Object { return &BadServerSalt{} },
|
||||
MsgResendReqTypeID: func() bin.Object { return &MsgResendReq{} },
|
||||
MsgsStateReqTypeID: func() bin.Object { return &MsgsStateReq{} },
|
||||
MsgsStateInfoTypeID: func() bin.Object { return &MsgsStateInfo{} },
|
||||
MsgsAllInfoTypeID: func() bin.Object { return &MsgsAllInfo{} },
|
||||
MsgDetailedInfoTypeID: func() bin.Object { return &MsgDetailedInfo{} },
|
||||
MsgNewDetailedInfoTypeID: func() bin.Object { return &MsgNewDetailedInfo{} },
|
||||
ReqPqRequestTypeID: func() bin.Object { return &ReqPqRequest{} },
|
||||
ReqPqMultiRequestTypeID: func() bin.Object { return &ReqPqMultiRequest{} },
|
||||
ReqDHParamsRequestTypeID: func() bin.Object { return &ReqDHParamsRequest{} },
|
||||
SetClientDHParamsRequestTypeID: func() bin.Object { return &SetClientDHParamsRequest{} },
|
||||
RPCDropAnswerRequestTypeID: func() bin.Object { return &RPCDropAnswerRequest{} },
|
||||
GetFutureSaltsRequestTypeID: func() bin.Object { return &GetFutureSaltsRequest{} },
|
||||
PingRequestTypeID: func() bin.Object { return &PingRequest{} },
|
||||
PingDelayDisconnectRequestTypeID: func() bin.Object { return &PingDelayDisconnectRequest{} },
|
||||
DestroySessionRequestTypeID: func() bin.Object { return &DestroySessionRequest{} },
|
||||
HTTPWaitRequestTypeID: func() bin.Object { return &HTTPWaitRequest{} },
|
||||
}
|
||||
}
|
||||
|
||||
// ClassConstructorsMap maps class schema name to constructors type ids.
|
||||
func ClassConstructorsMap() map[string][]uint32 {
|
||||
return map[string][]uint32{
|
||||
BadMsgNotificationClassName: {
|
||||
BadMsgNotificationTypeID,
|
||||
BadServerSaltTypeID,
|
||||
},
|
||||
DestroySessionResClassName: {
|
||||
DestroySessionOkTypeID,
|
||||
DestroySessionNoneTypeID,
|
||||
},
|
||||
MsgDetailedInfoClassName: {
|
||||
MsgDetailedInfoTypeID,
|
||||
MsgNewDetailedInfoTypeID,
|
||||
},
|
||||
PQInnerDataClassName: {
|
||||
PQInnerDataTypeID,
|
||||
PQInnerDataDCTypeID,
|
||||
PQInnerDataTempDCTypeID,
|
||||
},
|
||||
RPCDropAnswerClassName: {
|
||||
RPCAnswerUnknownTypeID,
|
||||
RPCAnswerDroppedRunningTypeID,
|
||||
RPCAnswerDroppedTypeID,
|
||||
},
|
||||
ServerDHParamsClassName: {
|
||||
ServerDHParamsFailTypeID,
|
||||
ServerDHParamsOkTypeID,
|
||||
},
|
||||
SetClientDHParamsAnswerClassName: {
|
||||
DhGenOkTypeID,
|
||||
DhGenRetryTypeID,
|
||||
DhGenFailTypeID,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ReqDHParamsRequest represents TL type `req_DH_params#d712e4be`.
|
||||
type ReqDHParamsRequest struct {
|
||||
// Nonce field of ReqDHParamsRequest.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of ReqDHParamsRequest.
|
||||
ServerNonce bin.Int128
|
||||
// P field of ReqDHParamsRequest.
|
||||
P []byte
|
||||
// Q field of ReqDHParamsRequest.
|
||||
Q []byte
|
||||
// PublicKeyFingerprint field of ReqDHParamsRequest.
|
||||
PublicKeyFingerprint int64
|
||||
// EncryptedData field of ReqDHParamsRequest.
|
||||
EncryptedData []byte
|
||||
}
|
||||
|
||||
// ReqDHParamsRequestTypeID is TL type id of ReqDHParamsRequest.
|
||||
const ReqDHParamsRequestTypeID = 0xd712e4be
|
||||
|
||||
// Ensuring interfaces in compile-time for ReqDHParamsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &ReqDHParamsRequest{}
|
||||
_ bin.Decoder = &ReqDHParamsRequest{}
|
||||
_ bin.BareEncoder = &ReqDHParamsRequest{}
|
||||
_ bin.BareDecoder = &ReqDHParamsRequest{}
|
||||
)
|
||||
|
||||
func (r *ReqDHParamsRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(r.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(r.P == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.Q == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.PublicKeyFingerprint == 0) {
|
||||
return false
|
||||
}
|
||||
if !(r.EncryptedData == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *ReqDHParamsRequest) String() string {
|
||||
if r == nil {
|
||||
return "ReqDHParamsRequest(nil)"
|
||||
}
|
||||
type Alias ReqDHParamsRequest
|
||||
return fmt.Sprintf("ReqDHParamsRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ReqDHParamsRequest) TypeID() uint32 {
|
||||
return ReqDHParamsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ReqDHParamsRequest) TypeName() string {
|
||||
return "req_DH_params"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *ReqDHParamsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "req_DH_params",
|
||||
ID: ReqDHParamsRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "P",
|
||||
SchemaName: "p",
|
||||
},
|
||||
{
|
||||
Name: "Q",
|
||||
SchemaName: "q",
|
||||
},
|
||||
{
|
||||
Name: "PublicKeyFingerprint",
|
||||
SchemaName: "public_key_fingerprint",
|
||||
},
|
||||
{
|
||||
Name: "EncryptedData",
|
||||
SchemaName: "encrypted_data",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *ReqDHParamsRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode req_DH_params#d712e4be as nil")
|
||||
}
|
||||
b.PutID(ReqDHParamsRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *ReqDHParamsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode req_DH_params#d712e4be as nil")
|
||||
}
|
||||
b.PutInt128(r.Nonce)
|
||||
b.PutInt128(r.ServerNonce)
|
||||
b.PutBytes(r.P)
|
||||
b.PutBytes(r.Q)
|
||||
b.PutLong(r.PublicKeyFingerprint)
|
||||
b.PutBytes(r.EncryptedData)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *ReqDHParamsRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode req_DH_params#d712e4be to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ReqDHParamsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *ReqDHParamsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode req_DH_params#d712e4be to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: field nonce: %w", err)
|
||||
}
|
||||
r.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: field server_nonce: %w", err)
|
||||
}
|
||||
r.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: field p: %w", err)
|
||||
}
|
||||
r.P = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: field q: %w", err)
|
||||
}
|
||||
r.Q = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: field public_key_fingerprint: %w", err)
|
||||
}
|
||||
r.PublicKeyFingerprint = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_DH_params#d712e4be: field encrypted_data: %w", err)
|
||||
}
|
||||
r.EncryptedData = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (r *ReqDHParamsRequest) GetNonce() (value bin.Int128) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (r *ReqDHParamsRequest) GetServerNonce() (value bin.Int128) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ServerNonce
|
||||
}
|
||||
|
||||
// GetP returns value of P field.
|
||||
func (r *ReqDHParamsRequest) GetP() (value []byte) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.P
|
||||
}
|
||||
|
||||
// GetQ returns value of Q field.
|
||||
func (r *ReqDHParamsRequest) GetQ() (value []byte) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Q
|
||||
}
|
||||
|
||||
// GetPublicKeyFingerprint returns value of PublicKeyFingerprint field.
|
||||
func (r *ReqDHParamsRequest) GetPublicKeyFingerprint() (value int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.PublicKeyFingerprint
|
||||
}
|
||||
|
||||
// GetEncryptedData returns value of EncryptedData field.
|
||||
func (r *ReqDHParamsRequest) GetEncryptedData() (value []byte) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.EncryptedData
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ReqPqRequest represents TL type `req_pq#60469778`.
|
||||
type ReqPqRequest struct {
|
||||
// Nonce field of ReqPqRequest.
|
||||
Nonce bin.Int128
|
||||
}
|
||||
|
||||
// ReqPqRequestTypeID is TL type id of ReqPqRequest.
|
||||
const ReqPqRequestTypeID = 0x60469778
|
||||
|
||||
// Ensuring interfaces in compile-time for ReqPqRequest.
|
||||
var (
|
||||
_ bin.Encoder = &ReqPqRequest{}
|
||||
_ bin.Decoder = &ReqPqRequest{}
|
||||
_ bin.BareEncoder = &ReqPqRequest{}
|
||||
_ bin.BareDecoder = &ReqPqRequest{}
|
||||
)
|
||||
|
||||
func (r *ReqPqRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *ReqPqRequest) String() string {
|
||||
if r == nil {
|
||||
return "ReqPqRequest(nil)"
|
||||
}
|
||||
type Alias ReqPqRequest
|
||||
return fmt.Sprintf("ReqPqRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ReqPqRequest) TypeID() uint32 {
|
||||
return ReqPqRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ReqPqRequest) TypeName() string {
|
||||
return "req_pq"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *ReqPqRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "req_pq",
|
||||
ID: ReqPqRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *ReqPqRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode req_pq#60469778 as nil")
|
||||
}
|
||||
b.PutID(ReqPqRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *ReqPqRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode req_pq#60469778 as nil")
|
||||
}
|
||||
b.PutInt128(r.Nonce)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *ReqPqRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode req_pq#60469778 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ReqPqRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode req_pq#60469778: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *ReqPqRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode req_pq#60469778 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_pq#60469778: field nonce: %w", err)
|
||||
}
|
||||
r.Nonce = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (r *ReqPqRequest) GetNonce() (value bin.Int128) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Nonce
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ReqPqMultiRequest represents TL type `req_pq_multi#be7e8ef1`.
|
||||
type ReqPqMultiRequest struct {
|
||||
// Nonce field of ReqPqMultiRequest.
|
||||
Nonce bin.Int128
|
||||
}
|
||||
|
||||
// ReqPqMultiRequestTypeID is TL type id of ReqPqMultiRequest.
|
||||
const ReqPqMultiRequestTypeID = 0xbe7e8ef1
|
||||
|
||||
// Ensuring interfaces in compile-time for ReqPqMultiRequest.
|
||||
var (
|
||||
_ bin.Encoder = &ReqPqMultiRequest{}
|
||||
_ bin.Decoder = &ReqPqMultiRequest{}
|
||||
_ bin.BareEncoder = &ReqPqMultiRequest{}
|
||||
_ bin.BareDecoder = &ReqPqMultiRequest{}
|
||||
)
|
||||
|
||||
func (r *ReqPqMultiRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *ReqPqMultiRequest) String() string {
|
||||
if r == nil {
|
||||
return "ReqPqMultiRequest(nil)"
|
||||
}
|
||||
type Alias ReqPqMultiRequest
|
||||
return fmt.Sprintf("ReqPqMultiRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ReqPqMultiRequest) TypeID() uint32 {
|
||||
return ReqPqMultiRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ReqPqMultiRequest) TypeName() string {
|
||||
return "req_pq_multi"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *ReqPqMultiRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "req_pq_multi",
|
||||
ID: ReqPqMultiRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *ReqPqMultiRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode req_pq_multi#be7e8ef1 as nil")
|
||||
}
|
||||
b.PutID(ReqPqMultiRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *ReqPqMultiRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode req_pq_multi#be7e8ef1 as nil")
|
||||
}
|
||||
b.PutInt128(r.Nonce)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *ReqPqMultiRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode req_pq_multi#be7e8ef1 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ReqPqMultiRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode req_pq_multi#be7e8ef1: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *ReqPqMultiRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode req_pq_multi#be7e8ef1 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode req_pq_multi#be7e8ef1: field nonce: %w", err)
|
||||
}
|
||||
r.Nonce = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (r *ReqPqMultiRequest) GetNonce() (value bin.Int128) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Nonce
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ResPQ represents TL type `resPQ#5162463`.
|
||||
type ResPQ struct {
|
||||
// Nonce field of ResPQ.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of ResPQ.
|
||||
ServerNonce bin.Int128
|
||||
// Pq field of ResPQ.
|
||||
Pq []byte
|
||||
// ServerPublicKeyFingerprints field of ResPQ.
|
||||
ServerPublicKeyFingerprints []int64
|
||||
}
|
||||
|
||||
// ResPQTypeID is TL type id of ResPQ.
|
||||
const ResPQTypeID = 0x5162463
|
||||
|
||||
// Ensuring interfaces in compile-time for ResPQ.
|
||||
var (
|
||||
_ bin.Encoder = &ResPQ{}
|
||||
_ bin.Decoder = &ResPQ{}
|
||||
_ bin.BareEncoder = &ResPQ{}
|
||||
_ bin.BareDecoder = &ResPQ{}
|
||||
)
|
||||
|
||||
func (r *ResPQ) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(r.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(r.Pq == nil) {
|
||||
return false
|
||||
}
|
||||
if !(r.ServerPublicKeyFingerprints == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *ResPQ) String() string {
|
||||
if r == nil {
|
||||
return "ResPQ(nil)"
|
||||
}
|
||||
type Alias ResPQ
|
||||
return fmt.Sprintf("ResPQ%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ResPQ) TypeID() uint32 {
|
||||
return ResPQTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ResPQ) TypeName() string {
|
||||
return "resPQ"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *ResPQ) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "resPQ",
|
||||
ID: ResPQTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "Pq",
|
||||
SchemaName: "pq",
|
||||
},
|
||||
{
|
||||
Name: "ServerPublicKeyFingerprints",
|
||||
SchemaName: "server_public_key_fingerprints",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *ResPQ) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode resPQ#5162463 as nil")
|
||||
}
|
||||
b.PutID(ResPQTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *ResPQ) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode resPQ#5162463 as nil")
|
||||
}
|
||||
b.PutInt128(r.Nonce)
|
||||
b.PutInt128(r.ServerNonce)
|
||||
b.PutBytes(r.Pq)
|
||||
b.PutVectorHeader(len(r.ServerPublicKeyFingerprints))
|
||||
for _, v := range r.ServerPublicKeyFingerprints {
|
||||
b.PutLong(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *ResPQ) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode resPQ#5162463 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ResPQTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode resPQ#5162463: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *ResPQ) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode resPQ#5162463 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode resPQ#5162463: field nonce: %w", err)
|
||||
}
|
||||
r.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode resPQ#5162463: field server_nonce: %w", err)
|
||||
}
|
||||
r.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode resPQ#5162463: field pq: %w", err)
|
||||
}
|
||||
r.Pq = value
|
||||
}
|
||||
{
|
||||
headerLen, err := b.VectorHeader()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode resPQ#5162463: field server_public_key_fingerprints: %w", err)
|
||||
}
|
||||
|
||||
if headerLen > 0 {
|
||||
r.ServerPublicKeyFingerprints = make([]int64, 0, headerLen%bin.PreallocateLimit)
|
||||
}
|
||||
for idx := 0; idx < headerLen; idx++ {
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode resPQ#5162463: field server_public_key_fingerprints: %w", err)
|
||||
}
|
||||
r.ServerPublicKeyFingerprints = append(r.ServerPublicKeyFingerprints, value)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (r *ResPQ) GetNonce() (value bin.Int128) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (r *ResPQ) GetServerNonce() (value bin.Int128) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ServerNonce
|
||||
}
|
||||
|
||||
// GetPq returns value of Pq field.
|
||||
func (r *ResPQ) GetPq() (value []byte) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Pq
|
||||
}
|
||||
|
||||
// GetServerPublicKeyFingerprints returns value of ServerPublicKeyFingerprints field.
|
||||
func (r *ResPQ) GetServerPublicKeyFingerprints() (value []int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ServerPublicKeyFingerprints
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// RPCDropAnswerRequest represents TL type `rpc_drop_answer#58e4a740`.
|
||||
type RPCDropAnswerRequest struct {
|
||||
// ReqMsgID field of RPCDropAnswerRequest.
|
||||
ReqMsgID int64
|
||||
}
|
||||
|
||||
// RPCDropAnswerRequestTypeID is TL type id of RPCDropAnswerRequest.
|
||||
const RPCDropAnswerRequestTypeID = 0x58e4a740
|
||||
|
||||
// Ensuring interfaces in compile-time for RPCDropAnswerRequest.
|
||||
var (
|
||||
_ bin.Encoder = &RPCDropAnswerRequest{}
|
||||
_ bin.Decoder = &RPCDropAnswerRequest{}
|
||||
_ bin.BareEncoder = &RPCDropAnswerRequest{}
|
||||
_ bin.BareDecoder = &RPCDropAnswerRequest{}
|
||||
)
|
||||
|
||||
func (r *RPCDropAnswerRequest) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.ReqMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RPCDropAnswerRequest) String() string {
|
||||
if r == nil {
|
||||
return "RPCDropAnswerRequest(nil)"
|
||||
}
|
||||
type Alias RPCDropAnswerRequest
|
||||
return fmt.Sprintf("RPCDropAnswerRequest%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RPCDropAnswerRequest) TypeID() uint32 {
|
||||
return RPCDropAnswerRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RPCDropAnswerRequest) TypeName() string {
|
||||
return "rpc_drop_answer"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RPCDropAnswerRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "rpc_drop_answer",
|
||||
ID: RPCDropAnswerRequestTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ReqMsgID",
|
||||
SchemaName: "req_msg_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RPCDropAnswerRequest) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_drop_answer#58e4a740 as nil")
|
||||
}
|
||||
b.PutID(RPCDropAnswerRequestTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RPCDropAnswerRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_drop_answer#58e4a740 as nil")
|
||||
}
|
||||
b.PutLong(r.ReqMsgID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RPCDropAnswerRequest) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_drop_answer#58e4a740 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RPCDropAnswerRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_drop_answer#58e4a740: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RPCDropAnswerRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_drop_answer#58e4a740 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_drop_answer#58e4a740: field req_msg_id: %w", err)
|
||||
}
|
||||
r.ReqMsgID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetReqMsgID returns value of ReqMsgID field.
|
||||
func (r *RPCDropAnswerRequest) GetReqMsgID() (value int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ReqMsgID
|
||||
}
|
||||
@@ -0,0 +1,500 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// RPCAnswerUnknown represents TL type `rpc_answer_unknown#5e2ad36e`.
|
||||
type RPCAnswerUnknown struct {
|
||||
}
|
||||
|
||||
// RPCAnswerUnknownTypeID is TL type id of RPCAnswerUnknown.
|
||||
const RPCAnswerUnknownTypeID = 0x5e2ad36e
|
||||
|
||||
// construct implements constructor of RPCDropAnswerClass.
|
||||
func (r RPCAnswerUnknown) construct() RPCDropAnswerClass { return &r }
|
||||
|
||||
// Ensuring interfaces in compile-time for RPCAnswerUnknown.
|
||||
var (
|
||||
_ bin.Encoder = &RPCAnswerUnknown{}
|
||||
_ bin.Decoder = &RPCAnswerUnknown{}
|
||||
_ bin.BareEncoder = &RPCAnswerUnknown{}
|
||||
_ bin.BareDecoder = &RPCAnswerUnknown{}
|
||||
|
||||
_ RPCDropAnswerClass = &RPCAnswerUnknown{}
|
||||
)
|
||||
|
||||
func (r *RPCAnswerUnknown) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RPCAnswerUnknown) String() string {
|
||||
if r == nil {
|
||||
return "RPCAnswerUnknown(nil)"
|
||||
}
|
||||
type Alias RPCAnswerUnknown
|
||||
return fmt.Sprintf("RPCAnswerUnknown%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RPCAnswerUnknown) TypeID() uint32 {
|
||||
return RPCAnswerUnknownTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RPCAnswerUnknown) TypeName() string {
|
||||
return "rpc_answer_unknown"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RPCAnswerUnknown) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "rpc_answer_unknown",
|
||||
ID: RPCAnswerUnknownTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RPCAnswerUnknown) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_answer_unknown#5e2ad36e as nil")
|
||||
}
|
||||
b.PutID(RPCAnswerUnknownTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RPCAnswerUnknown) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_answer_unknown#5e2ad36e as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RPCAnswerUnknown) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_answer_unknown#5e2ad36e to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RPCAnswerUnknownTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_answer_unknown#5e2ad36e: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RPCAnswerUnknown) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_answer_unknown#5e2ad36e to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RPCAnswerDroppedRunning represents TL type `rpc_answer_dropped_running#cd78e586`.
|
||||
type RPCAnswerDroppedRunning struct {
|
||||
}
|
||||
|
||||
// RPCAnswerDroppedRunningTypeID is TL type id of RPCAnswerDroppedRunning.
|
||||
const RPCAnswerDroppedRunningTypeID = 0xcd78e586
|
||||
|
||||
// construct implements constructor of RPCDropAnswerClass.
|
||||
func (r RPCAnswerDroppedRunning) construct() RPCDropAnswerClass { return &r }
|
||||
|
||||
// Ensuring interfaces in compile-time for RPCAnswerDroppedRunning.
|
||||
var (
|
||||
_ bin.Encoder = &RPCAnswerDroppedRunning{}
|
||||
_ bin.Decoder = &RPCAnswerDroppedRunning{}
|
||||
_ bin.BareEncoder = &RPCAnswerDroppedRunning{}
|
||||
_ bin.BareDecoder = &RPCAnswerDroppedRunning{}
|
||||
|
||||
_ RPCDropAnswerClass = &RPCAnswerDroppedRunning{}
|
||||
)
|
||||
|
||||
func (r *RPCAnswerDroppedRunning) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RPCAnswerDroppedRunning) String() string {
|
||||
if r == nil {
|
||||
return "RPCAnswerDroppedRunning(nil)"
|
||||
}
|
||||
type Alias RPCAnswerDroppedRunning
|
||||
return fmt.Sprintf("RPCAnswerDroppedRunning%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RPCAnswerDroppedRunning) TypeID() uint32 {
|
||||
return RPCAnswerDroppedRunningTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RPCAnswerDroppedRunning) TypeName() string {
|
||||
return "rpc_answer_dropped_running"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RPCAnswerDroppedRunning) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "rpc_answer_dropped_running",
|
||||
ID: RPCAnswerDroppedRunningTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RPCAnswerDroppedRunning) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_answer_dropped_running#cd78e586 as nil")
|
||||
}
|
||||
b.PutID(RPCAnswerDroppedRunningTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RPCAnswerDroppedRunning) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_answer_dropped_running#cd78e586 as nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RPCAnswerDroppedRunning) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_answer_dropped_running#cd78e586 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RPCAnswerDroppedRunningTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_answer_dropped_running#cd78e586: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RPCAnswerDroppedRunning) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_answer_dropped_running#cd78e586 to nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RPCAnswerDropped represents TL type `rpc_answer_dropped#a43ad8b7`.
|
||||
type RPCAnswerDropped struct {
|
||||
// MsgID field of RPCAnswerDropped.
|
||||
MsgID int64
|
||||
// SeqNo field of RPCAnswerDropped.
|
||||
SeqNo int
|
||||
// Bytes field of RPCAnswerDropped.
|
||||
Bytes int
|
||||
}
|
||||
|
||||
// RPCAnswerDroppedTypeID is TL type id of RPCAnswerDropped.
|
||||
const RPCAnswerDroppedTypeID = 0xa43ad8b7
|
||||
|
||||
// construct implements constructor of RPCDropAnswerClass.
|
||||
func (r RPCAnswerDropped) construct() RPCDropAnswerClass { return &r }
|
||||
|
||||
// Ensuring interfaces in compile-time for RPCAnswerDropped.
|
||||
var (
|
||||
_ bin.Encoder = &RPCAnswerDropped{}
|
||||
_ bin.Decoder = &RPCAnswerDropped{}
|
||||
_ bin.BareEncoder = &RPCAnswerDropped{}
|
||||
_ bin.BareDecoder = &RPCAnswerDropped{}
|
||||
|
||||
_ RPCDropAnswerClass = &RPCAnswerDropped{}
|
||||
)
|
||||
|
||||
func (r *RPCAnswerDropped) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(r.SeqNo == 0) {
|
||||
return false
|
||||
}
|
||||
if !(r.Bytes == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RPCAnswerDropped) String() string {
|
||||
if r == nil {
|
||||
return "RPCAnswerDropped(nil)"
|
||||
}
|
||||
type Alias RPCAnswerDropped
|
||||
return fmt.Sprintf("RPCAnswerDropped%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RPCAnswerDropped) TypeID() uint32 {
|
||||
return RPCAnswerDroppedTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RPCAnswerDropped) TypeName() string {
|
||||
return "rpc_answer_dropped"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RPCAnswerDropped) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "rpc_answer_dropped",
|
||||
ID: RPCAnswerDroppedTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "SeqNo",
|
||||
SchemaName: "seq_no",
|
||||
},
|
||||
{
|
||||
Name: "Bytes",
|
||||
SchemaName: "bytes",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RPCAnswerDropped) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_answer_dropped#a43ad8b7 as nil")
|
||||
}
|
||||
b.PutID(RPCAnswerDroppedTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RPCAnswerDropped) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_answer_dropped#a43ad8b7 as nil")
|
||||
}
|
||||
b.PutLong(r.MsgID)
|
||||
b.PutInt(r.SeqNo)
|
||||
b.PutInt(r.Bytes)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RPCAnswerDropped) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_answer_dropped#a43ad8b7 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RPCAnswerDroppedTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_answer_dropped#a43ad8b7: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RPCAnswerDropped) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_answer_dropped#a43ad8b7 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_answer_dropped#a43ad8b7: field msg_id: %w", err)
|
||||
}
|
||||
r.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_answer_dropped#a43ad8b7: field seq_no: %w", err)
|
||||
}
|
||||
r.SeqNo = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_answer_dropped#a43ad8b7: field bytes: %w", err)
|
||||
}
|
||||
r.Bytes = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (r *RPCAnswerDropped) GetMsgID() (value int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.MsgID
|
||||
}
|
||||
|
||||
// GetSeqNo returns value of SeqNo field.
|
||||
func (r *RPCAnswerDropped) GetSeqNo() (value int) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.SeqNo
|
||||
}
|
||||
|
||||
// GetBytes returns value of Bytes field.
|
||||
func (r *RPCAnswerDropped) GetBytes() (value int) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Bytes
|
||||
}
|
||||
|
||||
// RPCDropAnswerClassName is schema name of RPCDropAnswerClass.
|
||||
const RPCDropAnswerClassName = "RpcDropAnswer"
|
||||
|
||||
// RPCDropAnswerClass represents RpcDropAnswer generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodeRPCDropAnswer(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.RPCAnswerUnknown: // rpc_answer_unknown#5e2ad36e
|
||||
// case *mt.RPCAnswerDroppedRunning: // rpc_answer_dropped_running#cd78e586
|
||||
// case *mt.RPCAnswerDropped: // rpc_answer_dropped#a43ad8b7
|
||||
// default: panic(v)
|
||||
// }
|
||||
type RPCDropAnswerClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() RPCDropAnswerClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
}
|
||||
|
||||
// DecodeRPCDropAnswer implements binary de-serialization for RPCDropAnswerClass.
|
||||
func DecodeRPCDropAnswer(buf *bin.Buffer) (RPCDropAnswerClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case RPCAnswerUnknownTypeID:
|
||||
// Decoding rpc_answer_unknown#5e2ad36e.
|
||||
v := RPCAnswerUnknown{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode RPCDropAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case RPCAnswerDroppedRunningTypeID:
|
||||
// Decoding rpc_answer_dropped_running#cd78e586.
|
||||
v := RPCAnswerDroppedRunning{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode RPCDropAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case RPCAnswerDroppedTypeID:
|
||||
// Decoding rpc_answer_dropped#a43ad8b7.
|
||||
v := RPCAnswerDropped{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode RPCDropAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode RPCDropAnswerClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// RPCDropAnswer boxes the RPCDropAnswerClass providing a helper.
|
||||
type RPCDropAnswerBox struct {
|
||||
RpcDropAnswer RPCDropAnswerClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for RPCDropAnswerBox.
|
||||
func (b *RPCDropAnswerBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode RPCDropAnswerBox to nil")
|
||||
}
|
||||
v, err := DecodeRPCDropAnswer(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.RpcDropAnswer = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for RPCDropAnswerBox.
|
||||
func (b *RPCDropAnswerBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.RpcDropAnswer == nil {
|
||||
return fmt.Errorf("unable to encode RPCDropAnswerClass as nil")
|
||||
}
|
||||
return b.RpcDropAnswer.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// RPCError represents TL type `rpc_error#2144ca19`.
|
||||
type RPCError struct {
|
||||
// ErrorCode field of RPCError.
|
||||
ErrorCode int
|
||||
// ErrorMessage field of RPCError.
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
// RPCErrorTypeID is TL type id of RPCError.
|
||||
const RPCErrorTypeID = 0x2144ca19
|
||||
|
||||
// Ensuring interfaces in compile-time for RPCError.
|
||||
var (
|
||||
_ bin.Encoder = &RPCError{}
|
||||
_ bin.Decoder = &RPCError{}
|
||||
_ bin.BareEncoder = &RPCError{}
|
||||
_ bin.BareDecoder = &RPCError{}
|
||||
)
|
||||
|
||||
func (r *RPCError) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.ErrorCode == 0) {
|
||||
return false
|
||||
}
|
||||
if !(r.ErrorMessage == "") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RPCError) String() string {
|
||||
if r == nil {
|
||||
return "RPCError(nil)"
|
||||
}
|
||||
type Alias RPCError
|
||||
return fmt.Sprintf("RPCError%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RPCError) TypeID() uint32 {
|
||||
return RPCErrorTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RPCError) TypeName() string {
|
||||
return "rpc_error"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RPCError) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "rpc_error",
|
||||
ID: RPCErrorTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ErrorCode",
|
||||
SchemaName: "error_code",
|
||||
},
|
||||
{
|
||||
Name: "ErrorMessage",
|
||||
SchemaName: "error_message",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RPCError) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_error#2144ca19 as nil")
|
||||
}
|
||||
b.PutID(RPCErrorTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RPCError) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_error#2144ca19 as nil")
|
||||
}
|
||||
b.PutInt(r.ErrorCode)
|
||||
b.PutString(r.ErrorMessage)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RPCError) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_error#2144ca19 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RPCErrorTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_error#2144ca19: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RPCError) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_error#2144ca19 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_error#2144ca19: field error_code: %w", err)
|
||||
}
|
||||
r.ErrorCode = value
|
||||
}
|
||||
{
|
||||
value, err := b.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_error#2144ca19: field error_message: %w", err)
|
||||
}
|
||||
r.ErrorMessage = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetErrorCode returns value of ErrorCode field.
|
||||
func (r *RPCError) GetErrorCode() (value int) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ErrorCode
|
||||
}
|
||||
|
||||
// GetErrorMessage returns value of ErrorMessage field.
|
||||
func (r *RPCError) GetErrorMessage() (value string) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ErrorMessage
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// RPCResult represents TL type `rpc_result#f35c6d01`.
|
||||
type RPCResult struct {
|
||||
// ReqMsgID field of RPCResult.
|
||||
ReqMsgID int64
|
||||
// Result field of RPCResult.
|
||||
Result GzipPacked
|
||||
}
|
||||
|
||||
// RPCResultTypeID is TL type id of RPCResult.
|
||||
const RPCResultTypeID = 0xf35c6d01
|
||||
|
||||
// Ensuring interfaces in compile-time for RPCResult.
|
||||
var (
|
||||
_ bin.Encoder = &RPCResult{}
|
||||
_ bin.Decoder = &RPCResult{}
|
||||
_ bin.BareEncoder = &RPCResult{}
|
||||
_ bin.BareDecoder = &RPCResult{}
|
||||
)
|
||||
|
||||
func (r *RPCResult) Zero() bool {
|
||||
if r == nil {
|
||||
return true
|
||||
}
|
||||
if !(r.ReqMsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(r.Result.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (r *RPCResult) String() string {
|
||||
if r == nil {
|
||||
return "RPCResult(nil)"
|
||||
}
|
||||
type Alias RPCResult
|
||||
return fmt.Sprintf("RPCResult%+v", Alias(*r))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*RPCResult) TypeID() uint32 {
|
||||
return RPCResultTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*RPCResult) TypeName() string {
|
||||
return "rpc_result"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (r *RPCResult) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "rpc_result",
|
||||
ID: RPCResultTypeID,
|
||||
}
|
||||
if r == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ReqMsgID",
|
||||
SchemaName: "req_msg_id",
|
||||
},
|
||||
{
|
||||
Name: "Result",
|
||||
SchemaName: "result",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (r *RPCResult) Encode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_result#f35c6d01 as nil")
|
||||
}
|
||||
b.PutID(RPCResultTypeID)
|
||||
return r.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (r *RPCResult) EncodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't encode rpc_result#f35c6d01 as nil")
|
||||
}
|
||||
b.PutLong(r.ReqMsgID)
|
||||
if err := r.Result.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode rpc_result#f35c6d01: field result: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (r *RPCResult) Decode(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_result#f35c6d01 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(RPCResultTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_result#f35c6d01: %w", err)
|
||||
}
|
||||
return r.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (r *RPCResult) DecodeBare(b *bin.Buffer) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("can't decode rpc_result#f35c6d01 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_result#f35c6d01: field req_msg_id: %w", err)
|
||||
}
|
||||
r.ReqMsgID = value
|
||||
}
|
||||
{
|
||||
if err := r.Result.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode rpc_result#f35c6d01: field result: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetReqMsgID returns value of ReqMsgID field.
|
||||
func (r *RPCResult) GetReqMsgID() (value int64) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.ReqMsgID
|
||||
}
|
||||
|
||||
// GetResult returns value of Result field.
|
||||
func (r *RPCResult) GetResult() (value GzipPacked) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
return r.Result
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ServerDHInnerData represents TL type `server_DH_inner_data#b5890dba`.
|
||||
type ServerDHInnerData struct {
|
||||
// Nonce field of ServerDHInnerData.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of ServerDHInnerData.
|
||||
ServerNonce bin.Int128
|
||||
// G field of ServerDHInnerData.
|
||||
G int
|
||||
// DhPrime field of ServerDHInnerData.
|
||||
DhPrime []byte
|
||||
// GA field of ServerDHInnerData.
|
||||
GA []byte
|
||||
// ServerTime field of ServerDHInnerData.
|
||||
ServerTime int
|
||||
}
|
||||
|
||||
// ServerDHInnerDataTypeID is TL type id of ServerDHInnerData.
|
||||
const ServerDHInnerDataTypeID = 0xb5890dba
|
||||
|
||||
// Ensuring interfaces in compile-time for ServerDHInnerData.
|
||||
var (
|
||||
_ bin.Encoder = &ServerDHInnerData{}
|
||||
_ bin.Decoder = &ServerDHInnerData{}
|
||||
_ bin.BareEncoder = &ServerDHInnerData{}
|
||||
_ bin.BareDecoder = &ServerDHInnerData{}
|
||||
)
|
||||
|
||||
func (s *ServerDHInnerData) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.G == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.DhPrime == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.GA == nil) {
|
||||
return false
|
||||
}
|
||||
if !(s.ServerTime == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *ServerDHInnerData) String() string {
|
||||
if s == nil {
|
||||
return "ServerDHInnerData(nil)"
|
||||
}
|
||||
type Alias ServerDHInnerData
|
||||
return fmt.Sprintf("ServerDHInnerData%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ServerDHInnerData) TypeID() uint32 {
|
||||
return ServerDHInnerDataTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ServerDHInnerData) TypeName() string {
|
||||
return "server_DH_inner_data"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *ServerDHInnerData) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "server_DH_inner_data",
|
||||
ID: ServerDHInnerDataTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "G",
|
||||
SchemaName: "g",
|
||||
},
|
||||
{
|
||||
Name: "DhPrime",
|
||||
SchemaName: "dh_prime",
|
||||
},
|
||||
{
|
||||
Name: "GA",
|
||||
SchemaName: "g_a",
|
||||
},
|
||||
{
|
||||
Name: "ServerTime",
|
||||
SchemaName: "server_time",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *ServerDHInnerData) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode server_DH_inner_data#b5890dba as nil")
|
||||
}
|
||||
b.PutID(ServerDHInnerDataTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *ServerDHInnerData) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode server_DH_inner_data#b5890dba as nil")
|
||||
}
|
||||
b.PutInt128(s.Nonce)
|
||||
b.PutInt128(s.ServerNonce)
|
||||
b.PutInt(s.G)
|
||||
b.PutBytes(s.DhPrime)
|
||||
b.PutBytes(s.GA)
|
||||
b.PutInt(s.ServerTime)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *ServerDHInnerData) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode server_DH_inner_data#b5890dba to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ServerDHInnerDataTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *ServerDHInnerData) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode server_DH_inner_data#b5890dba to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field nonce: %w", err)
|
||||
}
|
||||
s.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field server_nonce: %w", err)
|
||||
}
|
||||
s.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field g: %w", err)
|
||||
}
|
||||
s.G = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field dh_prime: %w", err)
|
||||
}
|
||||
s.DhPrime = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field g_a: %w", err)
|
||||
}
|
||||
s.GA = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_inner_data#b5890dba: field server_time: %w", err)
|
||||
}
|
||||
s.ServerTime = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (s *ServerDHInnerData) GetNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (s *ServerDHInnerData) GetServerNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ServerNonce
|
||||
}
|
||||
|
||||
// GetG returns value of G field.
|
||||
func (s *ServerDHInnerData) GetG() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.G
|
||||
}
|
||||
|
||||
// GetDhPrime returns value of DhPrime field.
|
||||
func (s *ServerDHInnerData) GetDhPrime() (value []byte) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.DhPrime
|
||||
}
|
||||
|
||||
// GetGA returns value of GA field.
|
||||
func (s *ServerDHInnerData) GetGA() (value []byte) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.GA
|
||||
}
|
||||
|
||||
// GetServerTime returns value of ServerTime field.
|
||||
func (s *ServerDHInnerData) GetServerTime() (value int) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ServerTime
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ServerDHParamsFail represents TL type `server_DH_params_fail#79cb045d`.
|
||||
type ServerDHParamsFail struct {
|
||||
// Nonce field of ServerDHParamsFail.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of ServerDHParamsFail.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonceHash field of ServerDHParamsFail.
|
||||
NewNonceHash bin.Int128
|
||||
}
|
||||
|
||||
// ServerDHParamsFailTypeID is TL type id of ServerDHParamsFail.
|
||||
const ServerDHParamsFailTypeID = 0x79cb045d
|
||||
|
||||
// construct implements constructor of ServerDHParamsClass.
|
||||
func (s ServerDHParamsFail) construct() ServerDHParamsClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for ServerDHParamsFail.
|
||||
var (
|
||||
_ bin.Encoder = &ServerDHParamsFail{}
|
||||
_ bin.Decoder = &ServerDHParamsFail{}
|
||||
_ bin.BareEncoder = &ServerDHParamsFail{}
|
||||
_ bin.BareDecoder = &ServerDHParamsFail{}
|
||||
|
||||
_ ServerDHParamsClass = &ServerDHParamsFail{}
|
||||
)
|
||||
|
||||
func (s *ServerDHParamsFail) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.NewNonceHash == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *ServerDHParamsFail) String() string {
|
||||
if s == nil {
|
||||
return "ServerDHParamsFail(nil)"
|
||||
}
|
||||
type Alias ServerDHParamsFail
|
||||
return fmt.Sprintf("ServerDHParamsFail%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ServerDHParamsFail) TypeID() uint32 {
|
||||
return ServerDHParamsFailTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ServerDHParamsFail) TypeName() string {
|
||||
return "server_DH_params_fail"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *ServerDHParamsFail) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "server_DH_params_fail",
|
||||
ID: ServerDHParamsFailTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonceHash",
|
||||
SchemaName: "new_nonce_hash",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *ServerDHParamsFail) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode server_DH_params_fail#79cb045d as nil")
|
||||
}
|
||||
b.PutID(ServerDHParamsFailTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *ServerDHParamsFail) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode server_DH_params_fail#79cb045d as nil")
|
||||
}
|
||||
b.PutInt128(s.Nonce)
|
||||
b.PutInt128(s.ServerNonce)
|
||||
b.PutInt128(s.NewNonceHash)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *ServerDHParamsFail) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode server_DH_params_fail#79cb045d to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ServerDHParamsFailTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_fail#79cb045d: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *ServerDHParamsFail) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode server_DH_params_fail#79cb045d to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_fail#79cb045d: field nonce: %w", err)
|
||||
}
|
||||
s.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_fail#79cb045d: field server_nonce: %w", err)
|
||||
}
|
||||
s.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_fail#79cb045d: field new_nonce_hash: %w", err)
|
||||
}
|
||||
s.NewNonceHash = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (s *ServerDHParamsFail) GetNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (s *ServerDHParamsFail) GetServerNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonceHash returns value of NewNonceHash field.
|
||||
func (s *ServerDHParamsFail) GetNewNonceHash() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.NewNonceHash
|
||||
}
|
||||
|
||||
// ServerDHParamsOk represents TL type `server_DH_params_ok#d0e8075c`.
|
||||
type ServerDHParamsOk struct {
|
||||
// Nonce field of ServerDHParamsOk.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of ServerDHParamsOk.
|
||||
ServerNonce bin.Int128
|
||||
// EncryptedAnswer field of ServerDHParamsOk.
|
||||
EncryptedAnswer []byte
|
||||
}
|
||||
|
||||
// ServerDHParamsOkTypeID is TL type id of ServerDHParamsOk.
|
||||
const ServerDHParamsOkTypeID = 0xd0e8075c
|
||||
|
||||
// construct implements constructor of ServerDHParamsClass.
|
||||
func (s ServerDHParamsOk) construct() ServerDHParamsClass { return &s }
|
||||
|
||||
// Ensuring interfaces in compile-time for ServerDHParamsOk.
|
||||
var (
|
||||
_ bin.Encoder = &ServerDHParamsOk{}
|
||||
_ bin.Decoder = &ServerDHParamsOk{}
|
||||
_ bin.BareEncoder = &ServerDHParamsOk{}
|
||||
_ bin.BareDecoder = &ServerDHParamsOk{}
|
||||
|
||||
_ ServerDHParamsClass = &ServerDHParamsOk{}
|
||||
)
|
||||
|
||||
func (s *ServerDHParamsOk) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.EncryptedAnswer == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *ServerDHParamsOk) String() string {
|
||||
if s == nil {
|
||||
return "ServerDHParamsOk(nil)"
|
||||
}
|
||||
type Alias ServerDHParamsOk
|
||||
return fmt.Sprintf("ServerDHParamsOk%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ServerDHParamsOk) TypeID() uint32 {
|
||||
return ServerDHParamsOkTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ServerDHParamsOk) TypeName() string {
|
||||
return "server_DH_params_ok"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *ServerDHParamsOk) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "server_DH_params_ok",
|
||||
ID: ServerDHParamsOkTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "EncryptedAnswer",
|
||||
SchemaName: "encrypted_answer",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *ServerDHParamsOk) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode server_DH_params_ok#d0e8075c as nil")
|
||||
}
|
||||
b.PutID(ServerDHParamsOkTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *ServerDHParamsOk) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode server_DH_params_ok#d0e8075c as nil")
|
||||
}
|
||||
b.PutInt128(s.Nonce)
|
||||
b.PutInt128(s.ServerNonce)
|
||||
b.PutBytes(s.EncryptedAnswer)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *ServerDHParamsOk) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode server_DH_params_ok#d0e8075c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ServerDHParamsOkTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_ok#d0e8075c: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *ServerDHParamsOk) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode server_DH_params_ok#d0e8075c to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_ok#d0e8075c: field nonce: %w", err)
|
||||
}
|
||||
s.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_ok#d0e8075c: field server_nonce: %w", err)
|
||||
}
|
||||
s.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode server_DH_params_ok#d0e8075c: field encrypted_answer: %w", err)
|
||||
}
|
||||
s.EncryptedAnswer = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (s *ServerDHParamsOk) GetNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (s *ServerDHParamsOk) GetServerNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ServerNonce
|
||||
}
|
||||
|
||||
// GetEncryptedAnswer returns value of EncryptedAnswer field.
|
||||
func (s *ServerDHParamsOk) GetEncryptedAnswer() (value []byte) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.EncryptedAnswer
|
||||
}
|
||||
|
||||
// ServerDHParamsClassName is schema name of ServerDHParamsClass.
|
||||
const ServerDHParamsClassName = "Server_DH_Params"
|
||||
|
||||
// ServerDHParamsClass represents Server_DH_Params generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodeServerDHParams(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.ServerDHParamsFail: // server_DH_params_fail#79cb045d
|
||||
// case *mt.ServerDHParamsOk: // server_DH_params_ok#d0e8075c
|
||||
// default: panic(v)
|
||||
// }
|
||||
type ServerDHParamsClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() ServerDHParamsClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// Nonce field of ServerDHParamsFail.
|
||||
GetNonce() (value bin.Int128)
|
||||
// ServerNonce field of ServerDHParamsFail.
|
||||
GetServerNonce() (value bin.Int128)
|
||||
}
|
||||
|
||||
// DecodeServerDHParams implements binary de-serialization for ServerDHParamsClass.
|
||||
func DecodeServerDHParams(buf *bin.Buffer) (ServerDHParamsClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case ServerDHParamsFailTypeID:
|
||||
// Decoding server_DH_params_fail#79cb045d.
|
||||
v := ServerDHParamsFail{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ServerDHParamsClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case ServerDHParamsOkTypeID:
|
||||
// Decoding server_DH_params_ok#d0e8075c.
|
||||
v := ServerDHParamsOk{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode ServerDHParamsClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode ServerDHParamsClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// ServerDHParams boxes the ServerDHParamsClass providing a helper.
|
||||
type ServerDHParamsBox struct {
|
||||
Server_DH_Params ServerDHParamsClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for ServerDHParamsBox.
|
||||
func (b *ServerDHParamsBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode ServerDHParamsBox to nil")
|
||||
}
|
||||
v, err := DecodeServerDHParams(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.Server_DH_Params = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for ServerDHParamsBox.
|
||||
func (b *ServerDHParamsBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.Server_DH_Params == nil {
|
||||
return fmt.Errorf("unable to encode ServerDHParamsClass as nil")
|
||||
}
|
||||
return b.Server_DH_Params.Encode(buf)
|
||||
}
|
||||
@@ -0,0 +1,657 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// DhGenOk represents TL type `dh_gen_ok#3bcbf734`.
|
||||
type DhGenOk struct {
|
||||
// Nonce field of DhGenOk.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of DhGenOk.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonceHash1 field of DhGenOk.
|
||||
NewNonceHash1 bin.Int128
|
||||
}
|
||||
|
||||
// DhGenOkTypeID is TL type id of DhGenOk.
|
||||
const DhGenOkTypeID = 0x3bcbf734
|
||||
|
||||
// construct implements constructor of SetClientDHParamsAnswerClass.
|
||||
func (d DhGenOk) construct() SetClientDHParamsAnswerClass { return &d }
|
||||
|
||||
// Ensuring interfaces in compile-time for DhGenOk.
|
||||
var (
|
||||
_ bin.Encoder = &DhGenOk{}
|
||||
_ bin.Decoder = &DhGenOk{}
|
||||
_ bin.BareEncoder = &DhGenOk{}
|
||||
_ bin.BareDecoder = &DhGenOk{}
|
||||
|
||||
_ SetClientDHParamsAnswerClass = &DhGenOk{}
|
||||
)
|
||||
|
||||
func (d *DhGenOk) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(d.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(d.NewNonceHash1 == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DhGenOk) String() string {
|
||||
if d == nil {
|
||||
return "DhGenOk(nil)"
|
||||
}
|
||||
type Alias DhGenOk
|
||||
return fmt.Sprintf("DhGenOk%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DhGenOk) TypeID() uint32 {
|
||||
return DhGenOkTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DhGenOk) TypeName() string {
|
||||
return "dh_gen_ok"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DhGenOk) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "dh_gen_ok",
|
||||
ID: DhGenOkTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonceHash1",
|
||||
SchemaName: "new_nonce_hash1",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DhGenOk) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dh_gen_ok#3bcbf734 as nil")
|
||||
}
|
||||
b.PutID(DhGenOkTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DhGenOk) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dh_gen_ok#3bcbf734 as nil")
|
||||
}
|
||||
b.PutInt128(d.Nonce)
|
||||
b.PutInt128(d.ServerNonce)
|
||||
b.PutInt128(d.NewNonceHash1)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DhGenOk) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dh_gen_ok#3bcbf734 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DhGenOkTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_ok#3bcbf734: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DhGenOk) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dh_gen_ok#3bcbf734 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_ok#3bcbf734: field nonce: %w", err)
|
||||
}
|
||||
d.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_ok#3bcbf734: field server_nonce: %w", err)
|
||||
}
|
||||
d.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_ok#3bcbf734: field new_nonce_hash1: %w", err)
|
||||
}
|
||||
d.NewNonceHash1 = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (d *DhGenOk) GetNonce() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (d *DhGenOk) GetServerNonce() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonceHash1 returns value of NewNonceHash1 field.
|
||||
func (d *DhGenOk) GetNewNonceHash1() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.NewNonceHash1
|
||||
}
|
||||
|
||||
// DhGenRetry represents TL type `dh_gen_retry#46dc1fb9`.
|
||||
type DhGenRetry struct {
|
||||
// Nonce field of DhGenRetry.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of DhGenRetry.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonceHash2 field of DhGenRetry.
|
||||
NewNonceHash2 bin.Int128
|
||||
}
|
||||
|
||||
// DhGenRetryTypeID is TL type id of DhGenRetry.
|
||||
const DhGenRetryTypeID = 0x46dc1fb9
|
||||
|
||||
// construct implements constructor of SetClientDHParamsAnswerClass.
|
||||
func (d DhGenRetry) construct() SetClientDHParamsAnswerClass { return &d }
|
||||
|
||||
// Ensuring interfaces in compile-time for DhGenRetry.
|
||||
var (
|
||||
_ bin.Encoder = &DhGenRetry{}
|
||||
_ bin.Decoder = &DhGenRetry{}
|
||||
_ bin.BareEncoder = &DhGenRetry{}
|
||||
_ bin.BareDecoder = &DhGenRetry{}
|
||||
|
||||
_ SetClientDHParamsAnswerClass = &DhGenRetry{}
|
||||
)
|
||||
|
||||
func (d *DhGenRetry) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(d.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(d.NewNonceHash2 == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DhGenRetry) String() string {
|
||||
if d == nil {
|
||||
return "DhGenRetry(nil)"
|
||||
}
|
||||
type Alias DhGenRetry
|
||||
return fmt.Sprintf("DhGenRetry%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DhGenRetry) TypeID() uint32 {
|
||||
return DhGenRetryTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DhGenRetry) TypeName() string {
|
||||
return "dh_gen_retry"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DhGenRetry) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "dh_gen_retry",
|
||||
ID: DhGenRetryTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonceHash2",
|
||||
SchemaName: "new_nonce_hash2",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DhGenRetry) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dh_gen_retry#46dc1fb9 as nil")
|
||||
}
|
||||
b.PutID(DhGenRetryTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DhGenRetry) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dh_gen_retry#46dc1fb9 as nil")
|
||||
}
|
||||
b.PutInt128(d.Nonce)
|
||||
b.PutInt128(d.ServerNonce)
|
||||
b.PutInt128(d.NewNonceHash2)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DhGenRetry) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dh_gen_retry#46dc1fb9 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DhGenRetryTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_retry#46dc1fb9: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DhGenRetry) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dh_gen_retry#46dc1fb9 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_retry#46dc1fb9: field nonce: %w", err)
|
||||
}
|
||||
d.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_retry#46dc1fb9: field server_nonce: %w", err)
|
||||
}
|
||||
d.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_retry#46dc1fb9: field new_nonce_hash2: %w", err)
|
||||
}
|
||||
d.NewNonceHash2 = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (d *DhGenRetry) GetNonce() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (d *DhGenRetry) GetServerNonce() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonceHash2 returns value of NewNonceHash2 field.
|
||||
func (d *DhGenRetry) GetNewNonceHash2() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.NewNonceHash2
|
||||
}
|
||||
|
||||
// DhGenFail represents TL type `dh_gen_fail#a69dae02`.
|
||||
type DhGenFail struct {
|
||||
// Nonce field of DhGenFail.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of DhGenFail.
|
||||
ServerNonce bin.Int128
|
||||
// NewNonceHash3 field of DhGenFail.
|
||||
NewNonceHash3 bin.Int128
|
||||
}
|
||||
|
||||
// DhGenFailTypeID is TL type id of DhGenFail.
|
||||
const DhGenFailTypeID = 0xa69dae02
|
||||
|
||||
// construct implements constructor of SetClientDHParamsAnswerClass.
|
||||
func (d DhGenFail) construct() SetClientDHParamsAnswerClass { return &d }
|
||||
|
||||
// Ensuring interfaces in compile-time for DhGenFail.
|
||||
var (
|
||||
_ bin.Encoder = &DhGenFail{}
|
||||
_ bin.Decoder = &DhGenFail{}
|
||||
_ bin.BareEncoder = &DhGenFail{}
|
||||
_ bin.BareDecoder = &DhGenFail{}
|
||||
|
||||
_ SetClientDHParamsAnswerClass = &DhGenFail{}
|
||||
)
|
||||
|
||||
func (d *DhGenFail) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(d.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(d.NewNonceHash3 == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *DhGenFail) String() string {
|
||||
if d == nil {
|
||||
return "DhGenFail(nil)"
|
||||
}
|
||||
type Alias DhGenFail
|
||||
return fmt.Sprintf("DhGenFail%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*DhGenFail) TypeID() uint32 {
|
||||
return DhGenFailTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*DhGenFail) TypeName() string {
|
||||
return "dh_gen_fail"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *DhGenFail) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "dh_gen_fail",
|
||||
ID: DhGenFailTypeID,
|
||||
}
|
||||
if d == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "NewNonceHash3",
|
||||
SchemaName: "new_nonce_hash3",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (d *DhGenFail) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dh_gen_fail#a69dae02 as nil")
|
||||
}
|
||||
b.PutID(DhGenFailTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *DhGenFail) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode dh_gen_fail#a69dae02 as nil")
|
||||
}
|
||||
b.PutInt128(d.Nonce)
|
||||
b.PutInt128(d.ServerNonce)
|
||||
b.PutInt128(d.NewNonceHash3)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *DhGenFail) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dh_gen_fail#a69dae02 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(DhGenFailTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_fail#a69dae02: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *DhGenFail) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode dh_gen_fail#a69dae02 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_fail#a69dae02: field nonce: %w", err)
|
||||
}
|
||||
d.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_fail#a69dae02: field server_nonce: %w", err)
|
||||
}
|
||||
d.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode dh_gen_fail#a69dae02: field new_nonce_hash3: %w", err)
|
||||
}
|
||||
d.NewNonceHash3 = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (d *DhGenFail) GetNonce() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (d *DhGenFail) GetServerNonce() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.ServerNonce
|
||||
}
|
||||
|
||||
// GetNewNonceHash3 returns value of NewNonceHash3 field.
|
||||
func (d *DhGenFail) GetNewNonceHash3() (value bin.Int128) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.NewNonceHash3
|
||||
}
|
||||
|
||||
// SetClientDHParamsAnswerClassName is schema name of SetClientDHParamsAnswerClass.
|
||||
const SetClientDHParamsAnswerClassName = "Set_client_DH_params_answer"
|
||||
|
||||
// SetClientDHParamsAnswerClass represents Set_client_DH_params_answer generic type.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// g, err := mt.DecodeSetClientDHParamsAnswer(buf)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// switch v := g.(type) {
|
||||
// case *mt.DhGenOk: // dh_gen_ok#3bcbf734
|
||||
// case *mt.DhGenRetry: // dh_gen_retry#46dc1fb9
|
||||
// case *mt.DhGenFail: // dh_gen_fail#a69dae02
|
||||
// default: panic(v)
|
||||
// }
|
||||
type SetClientDHParamsAnswerClass interface {
|
||||
bin.Encoder
|
||||
bin.Decoder
|
||||
bin.BareEncoder
|
||||
bin.BareDecoder
|
||||
construct() SetClientDHParamsAnswerClass
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
TypeID() uint32
|
||||
// TypeName returns name of type in TL schema.
|
||||
TypeName() string
|
||||
// String implements fmt.Stringer.
|
||||
String() string
|
||||
// Zero returns true if current object has a zero value.
|
||||
Zero() bool
|
||||
|
||||
// Nonce field of DhGenOk.
|
||||
GetNonce() (value bin.Int128)
|
||||
// ServerNonce field of DhGenOk.
|
||||
GetServerNonce() (value bin.Int128)
|
||||
}
|
||||
|
||||
// DecodeSetClientDHParamsAnswer implements binary de-serialization for SetClientDHParamsAnswerClass.
|
||||
func DecodeSetClientDHParamsAnswer(buf *bin.Buffer) (SetClientDHParamsAnswerClass, error) {
|
||||
id, err := buf.PeekID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch id {
|
||||
case DhGenOkTypeID:
|
||||
// Decoding dh_gen_ok#3bcbf734.
|
||||
v := DhGenOk{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode SetClientDHParamsAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case DhGenRetryTypeID:
|
||||
// Decoding dh_gen_retry#46dc1fb9.
|
||||
v := DhGenRetry{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode SetClientDHParamsAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
case DhGenFailTypeID:
|
||||
// Decoding dh_gen_fail#a69dae02.
|
||||
v := DhGenFail{}
|
||||
if err := v.Decode(buf); err != nil {
|
||||
return nil, fmt.Errorf("unable to decode SetClientDHParamsAnswerClass: %w", err)
|
||||
}
|
||||
return &v, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unable to decode SetClientDHParamsAnswerClass: %w", bin.NewUnexpectedID(id))
|
||||
}
|
||||
}
|
||||
|
||||
// SetClientDHParamsAnswer boxes the SetClientDHParamsAnswerClass providing a helper.
|
||||
type SetClientDHParamsAnswerBox struct {
|
||||
Set_client_DH_params_answer SetClientDHParamsAnswerClass
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder for SetClientDHParamsAnswerBox.
|
||||
func (b *SetClientDHParamsAnswerBox) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("unable to decode SetClientDHParamsAnswerBox to nil")
|
||||
}
|
||||
v, err := DecodeSetClientDHParamsAnswer(buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode boxed value: %w", err)
|
||||
}
|
||||
b.Set_client_DH_params_answer = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// Encode implements bin.Encode for SetClientDHParamsAnswerBox.
|
||||
func (b *SetClientDHParamsAnswerBox) Encode(buf *bin.Buffer) error {
|
||||
if b == nil || b.Set_client_DH_params_answer == nil {
|
||||
return fmt.Errorf("unable to encode SetClientDHParamsAnswerClass as nil")
|
||||
}
|
||||
return b.Set_client_DH_params_answer.Encode(buf)
|
||||
}
|
||||
@@ -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{}
|
||||
)
|
||||
|
||||
// SetClientDHParamsRequest represents TL type `set_client_DH_params#f5045f1f`.
|
||||
type SetClientDHParamsRequest struct {
|
||||
// Nonce field of SetClientDHParamsRequest.
|
||||
Nonce bin.Int128
|
||||
// ServerNonce field of SetClientDHParamsRequest.
|
||||
ServerNonce bin.Int128
|
||||
// EncryptedData field of SetClientDHParamsRequest.
|
||||
EncryptedData []byte
|
||||
}
|
||||
|
||||
// SetClientDHParamsRequestTypeID is TL type id of SetClientDHParamsRequest.
|
||||
const SetClientDHParamsRequestTypeID = 0xf5045f1f
|
||||
|
||||
// Ensuring interfaces in compile-time for SetClientDHParamsRequest.
|
||||
var (
|
||||
_ bin.Encoder = &SetClientDHParamsRequest{}
|
||||
_ bin.Decoder = &SetClientDHParamsRequest{}
|
||||
_ bin.BareEncoder = &SetClientDHParamsRequest{}
|
||||
_ bin.BareDecoder = &SetClientDHParamsRequest{}
|
||||
)
|
||||
|
||||
func (s *SetClientDHParamsRequest) Zero() bool {
|
||||
if s == nil {
|
||||
return true
|
||||
}
|
||||
if !(s.Nonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.ServerNonce == bin.Int128{}) {
|
||||
return false
|
||||
}
|
||||
if !(s.EncryptedData == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (s *SetClientDHParamsRequest) String() string {
|
||||
if s == nil {
|
||||
return "SetClientDHParamsRequest(nil)"
|
||||
}
|
||||
type Alias SetClientDHParamsRequest
|
||||
return fmt.Sprintf("SetClientDHParamsRequest%+v", Alias(*s))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*SetClientDHParamsRequest) TypeID() uint32 {
|
||||
return SetClientDHParamsRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*SetClientDHParamsRequest) TypeName() string {
|
||||
return "set_client_DH_params"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (s *SetClientDHParamsRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "set_client_DH_params",
|
||||
ID: SetClientDHParamsRequestTypeID,
|
||||
}
|
||||
if s == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Nonce",
|
||||
SchemaName: "nonce",
|
||||
},
|
||||
{
|
||||
Name: "ServerNonce",
|
||||
SchemaName: "server_nonce",
|
||||
},
|
||||
{
|
||||
Name: "EncryptedData",
|
||||
SchemaName: "encrypted_data",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (s *SetClientDHParamsRequest) Encode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode set_client_DH_params#f5045f1f as nil")
|
||||
}
|
||||
b.PutID(SetClientDHParamsRequestTypeID)
|
||||
return s.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (s *SetClientDHParamsRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't encode set_client_DH_params#f5045f1f as nil")
|
||||
}
|
||||
b.PutInt128(s.Nonce)
|
||||
b.PutInt128(s.ServerNonce)
|
||||
b.PutBytes(s.EncryptedData)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (s *SetClientDHParamsRequest) Decode(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode set_client_DH_params#f5045f1f to nil")
|
||||
}
|
||||
if err := b.ConsumeID(SetClientDHParamsRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: %w", err)
|
||||
}
|
||||
return s.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (s *SetClientDHParamsRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if s == nil {
|
||||
return fmt.Errorf("can't decode set_client_DH_params#f5045f1f to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: field nonce: %w", err)
|
||||
}
|
||||
s.Nonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int128()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: field server_nonce: %w", err)
|
||||
}
|
||||
s.ServerNonce = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode set_client_DH_params#f5045f1f: field encrypted_data: %w", err)
|
||||
}
|
||||
s.EncryptedData = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNonce returns value of Nonce field.
|
||||
func (s *SetClientDHParamsRequest) GetNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.Nonce
|
||||
}
|
||||
|
||||
// GetServerNonce returns value of ServerNonce field.
|
||||
func (s *SetClientDHParamsRequest) GetServerNonce() (value bin.Int128) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.ServerNonce
|
||||
}
|
||||
|
||||
// GetEncryptedData returns value of EncryptedData field.
|
||||
func (s *SetClientDHParamsRequest) GetEncryptedData() (value []byte) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
return s.EncryptedData
|
||||
}
|
||||
Reference in New Issue
Block a user