7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
2532 lines
77 KiB
Go
2532 lines
77 KiB
Go
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tdapi
|
|
|
|
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{}
|
|
)
|
|
|
|
// AuthorizationStateWaitTdlibParameters represents TL type `authorizationStateWaitTdlibParameters#35ecf25c`.
|
|
type AuthorizationStateWaitTdlibParameters struct {
|
|
}
|
|
|
|
// AuthorizationStateWaitTdlibParametersTypeID is TL type id of AuthorizationStateWaitTdlibParameters.
|
|
const AuthorizationStateWaitTdlibParametersTypeID = 0x35ecf25c
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitTdlibParameters) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitTdlibParameters.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitTdlibParameters{}
|
|
_ bin.Decoder = &AuthorizationStateWaitTdlibParameters{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitTdlibParameters{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitTdlibParameters{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitTdlibParameters{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitTdlibParameters) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitTdlibParameters) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitTdlibParameters(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitTdlibParameters
|
|
return fmt.Sprintf("AuthorizationStateWaitTdlibParameters%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitTdlibParameters) TypeID() uint32 {
|
|
return AuthorizationStateWaitTdlibParametersTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitTdlibParameters) TypeName() string {
|
|
return "authorizationStateWaitTdlibParameters"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitTdlibParameters) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitTdlibParameters",
|
|
ID: AuthorizationStateWaitTdlibParametersTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitTdlibParameters) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitTdlibParameters#35ecf25c as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitTdlibParametersTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitTdlibParameters) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitTdlibParameters#35ecf25c as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitTdlibParameters) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitTdlibParameters#35ecf25c to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitTdlibParametersTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitTdlibParameters#35ecf25c: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitTdlibParameters) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitTdlibParameters#35ecf25c to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitTdlibParameters) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitTdlibParameters#35ecf25c as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitTdlibParameters")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitTdlibParameters) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitTdlibParameters#35ecf25c to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitTdlibParameters"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitTdlibParameters#35ecf25c: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// AuthorizationStateWaitPhoneNumber represents TL type `authorizationStateWaitPhoneNumber#124354e3`.
|
|
type AuthorizationStateWaitPhoneNumber struct {
|
|
}
|
|
|
|
// AuthorizationStateWaitPhoneNumberTypeID is TL type id of AuthorizationStateWaitPhoneNumber.
|
|
const AuthorizationStateWaitPhoneNumberTypeID = 0x124354e3
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitPhoneNumber) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitPhoneNumber.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitPhoneNumber{}
|
|
_ bin.Decoder = &AuthorizationStateWaitPhoneNumber{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitPhoneNumber{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitPhoneNumber{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitPhoneNumber{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitPhoneNumber) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitPhoneNumber) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitPhoneNumber(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitPhoneNumber
|
|
return fmt.Sprintf("AuthorizationStateWaitPhoneNumber%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitPhoneNumber) TypeID() uint32 {
|
|
return AuthorizationStateWaitPhoneNumberTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitPhoneNumber) TypeName() string {
|
|
return "authorizationStateWaitPhoneNumber"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitPhoneNumber) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitPhoneNumber",
|
|
ID: AuthorizationStateWaitPhoneNumberTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitPhoneNumber) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPhoneNumber#124354e3 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitPhoneNumberTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitPhoneNumber) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPhoneNumber#124354e3 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitPhoneNumber) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPhoneNumber#124354e3 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitPhoneNumberTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPhoneNumber#124354e3: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitPhoneNumber) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPhoneNumber#124354e3 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPhoneNumber#124354e3 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitPhoneNumber")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPhoneNumber#124354e3 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitPhoneNumber"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPhoneNumber#124354e3: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// AuthorizationStateWaitPremiumPurchase represents TL type `authorizationStateWaitPremiumPurchase#cc977b41`.
|
|
type AuthorizationStateWaitPremiumPurchase struct {
|
|
// Identifier of the store product that must be bought
|
|
StoreProductID string
|
|
}
|
|
|
|
// AuthorizationStateWaitPremiumPurchaseTypeID is TL type id of AuthorizationStateWaitPremiumPurchase.
|
|
const AuthorizationStateWaitPremiumPurchaseTypeID = 0xcc977b41
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitPremiumPurchase) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitPremiumPurchase.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitPremiumPurchase{}
|
|
_ bin.Decoder = &AuthorizationStateWaitPremiumPurchase{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitPremiumPurchase{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitPremiumPurchase{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitPremiumPurchase{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitPremiumPurchase) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.StoreProductID == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitPremiumPurchase(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitPremiumPurchase
|
|
return fmt.Sprintf("AuthorizationStateWaitPremiumPurchase%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitPremiumPurchase) TypeID() uint32 {
|
|
return AuthorizationStateWaitPremiumPurchaseTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitPremiumPurchase) TypeName() string {
|
|
return "authorizationStateWaitPremiumPurchase"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitPremiumPurchase",
|
|
ID: AuthorizationStateWaitPremiumPurchaseTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "StoreProductID",
|
|
SchemaName: "store_product_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPremiumPurchase#cc977b41 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitPremiumPurchaseTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPremiumPurchase#cc977b41 as nil")
|
|
}
|
|
b.PutString(a.StoreProductID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPremiumPurchase#cc977b41 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitPremiumPurchaseTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPremiumPurchase#cc977b41: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPremiumPurchase#cc977b41 to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPremiumPurchase#cc977b41: field store_product_id: %w", err)
|
|
}
|
|
a.StoreProductID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPremiumPurchase#cc977b41 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitPremiumPurchase")
|
|
b.Comma()
|
|
b.FieldStart("store_product_id")
|
|
b.PutString(a.StoreProductID)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPremiumPurchase#cc977b41 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitPremiumPurchase"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPremiumPurchase#cc977b41: %w", err)
|
|
}
|
|
case "store_product_id":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPremiumPurchase#cc977b41: field store_product_id: %w", err)
|
|
}
|
|
a.StoreProductID = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetStoreProductID returns value of StoreProductID field.
|
|
func (a *AuthorizationStateWaitPremiumPurchase) GetStoreProductID() (value string) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.StoreProductID
|
|
}
|
|
|
|
// AuthorizationStateWaitEmailAddress represents TL type `authorizationStateWaitEmailAddress#3e0471c7`.
|
|
type AuthorizationStateWaitEmailAddress struct {
|
|
// True, if authorization through Apple ID is allowed
|
|
AllowAppleID bool
|
|
// True, if authorization through Google ID is allowed
|
|
AllowGoogleID bool
|
|
}
|
|
|
|
// AuthorizationStateWaitEmailAddressTypeID is TL type id of AuthorizationStateWaitEmailAddress.
|
|
const AuthorizationStateWaitEmailAddressTypeID = 0x3e0471c7
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitEmailAddress) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitEmailAddress.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitEmailAddress{}
|
|
_ bin.Decoder = &AuthorizationStateWaitEmailAddress{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitEmailAddress{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitEmailAddress{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitEmailAddress{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitEmailAddress) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.AllowAppleID == false) {
|
|
return false
|
|
}
|
|
if !(a.AllowGoogleID == false) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitEmailAddress) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitEmailAddress(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitEmailAddress
|
|
return fmt.Sprintf("AuthorizationStateWaitEmailAddress%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitEmailAddress) TypeID() uint32 {
|
|
return AuthorizationStateWaitEmailAddressTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitEmailAddress) TypeName() string {
|
|
return "authorizationStateWaitEmailAddress"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitEmailAddress) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitEmailAddress",
|
|
ID: AuthorizationStateWaitEmailAddressTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "AllowAppleID",
|
|
SchemaName: "allow_apple_id",
|
|
},
|
|
{
|
|
Name: "AllowGoogleID",
|
|
SchemaName: "allow_google_id",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitEmailAddress) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitEmailAddress#3e0471c7 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitEmailAddressTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitEmailAddress) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitEmailAddress#3e0471c7 as nil")
|
|
}
|
|
b.PutBool(a.AllowAppleID)
|
|
b.PutBool(a.AllowGoogleID)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitEmailAddress) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitEmailAddress#3e0471c7 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitEmailAddressTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitEmailAddress) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitEmailAddress#3e0471c7 to nil")
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_apple_id: %w", err)
|
|
}
|
|
a.AllowAppleID = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_google_id: %w", err)
|
|
}
|
|
a.AllowGoogleID = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitEmailAddress#3e0471c7 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitEmailAddress")
|
|
b.Comma()
|
|
b.FieldStart("allow_apple_id")
|
|
b.PutBool(a.AllowAppleID)
|
|
b.Comma()
|
|
b.FieldStart("allow_google_id")
|
|
b.PutBool(a.AllowGoogleID)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitEmailAddress#3e0471c7 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitEmailAddress"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: %w", err)
|
|
}
|
|
case "allow_apple_id":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_apple_id: %w", err)
|
|
}
|
|
a.AllowAppleID = value
|
|
case "allow_google_id":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_google_id: %w", err)
|
|
}
|
|
a.AllowGoogleID = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetAllowAppleID returns value of AllowAppleID field.
|
|
func (a *AuthorizationStateWaitEmailAddress) GetAllowAppleID() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.AllowAppleID
|
|
}
|
|
|
|
// GetAllowGoogleID returns value of AllowGoogleID field.
|
|
func (a *AuthorizationStateWaitEmailAddress) GetAllowGoogleID() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.AllowGoogleID
|
|
}
|
|
|
|
// AuthorizationStateWaitEmailCode represents TL type `authorizationStateWaitEmailCode#909f025b`.
|
|
type AuthorizationStateWaitEmailCode struct {
|
|
// True, if authorization through Apple ID is allowed
|
|
AllowAppleID bool
|
|
// True, if authorization through Google ID is allowed
|
|
AllowGoogleID bool
|
|
// Information about the sent authentication code
|
|
CodeInfo EmailAddressAuthenticationCodeInfo
|
|
// Reset state of the email address; may be null if the email address can't be reset
|
|
EmailAddressResetState EmailAddressResetStateClass
|
|
}
|
|
|
|
// AuthorizationStateWaitEmailCodeTypeID is TL type id of AuthorizationStateWaitEmailCode.
|
|
const AuthorizationStateWaitEmailCodeTypeID = 0x909f025b
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitEmailCode) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitEmailCode.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitEmailCode{}
|
|
_ bin.Decoder = &AuthorizationStateWaitEmailCode{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitEmailCode{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitEmailCode{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitEmailCode{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitEmailCode) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.AllowAppleID == false) {
|
|
return false
|
|
}
|
|
if !(a.AllowGoogleID == false) {
|
|
return false
|
|
}
|
|
if !(a.CodeInfo.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.EmailAddressResetState == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitEmailCode) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitEmailCode(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitEmailCode
|
|
return fmt.Sprintf("AuthorizationStateWaitEmailCode%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitEmailCode) TypeID() uint32 {
|
|
return AuthorizationStateWaitEmailCodeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitEmailCode) TypeName() string {
|
|
return "authorizationStateWaitEmailCode"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitEmailCode) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitEmailCode",
|
|
ID: AuthorizationStateWaitEmailCodeTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "AllowAppleID",
|
|
SchemaName: "allow_apple_id",
|
|
},
|
|
{
|
|
Name: "AllowGoogleID",
|
|
SchemaName: "allow_google_id",
|
|
},
|
|
{
|
|
Name: "CodeInfo",
|
|
SchemaName: "code_info",
|
|
},
|
|
{
|
|
Name: "EmailAddressResetState",
|
|
SchemaName: "email_address_reset_state",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitEmailCode) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitEmailCode#909f025b as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitEmailCodeTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitEmailCode) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitEmailCode#909f025b as nil")
|
|
}
|
|
b.PutBool(a.AllowAppleID)
|
|
b.PutBool(a.AllowGoogleID)
|
|
if err := a.CodeInfo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err)
|
|
}
|
|
if a.EmailAddressResetState == nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state is nil")
|
|
}
|
|
if err := a.EmailAddressResetState.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitEmailCode) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitEmailCode#909f025b to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitEmailCodeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitEmailCode) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitEmailCode#909f025b to nil")
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_apple_id: %w", err)
|
|
}
|
|
a.AllowAppleID = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_google_id: %w", err)
|
|
}
|
|
a.AllowGoogleID = value
|
|
}
|
|
{
|
|
if err := a.CodeInfo.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeEmailAddressResetState(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err)
|
|
}
|
|
a.EmailAddressResetState = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitEmailCode) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitEmailCode#909f025b as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitEmailCode")
|
|
b.Comma()
|
|
b.FieldStart("allow_apple_id")
|
|
b.PutBool(a.AllowAppleID)
|
|
b.Comma()
|
|
b.FieldStart("allow_google_id")
|
|
b.PutBool(a.AllowGoogleID)
|
|
b.Comma()
|
|
b.FieldStart("code_info")
|
|
if err := a.CodeInfo.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("email_address_reset_state")
|
|
if a.EmailAddressResetState == nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state is nil")
|
|
}
|
|
if err := a.EmailAddressResetState.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitEmailCode) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitEmailCode#909f025b to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitEmailCode"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: %w", err)
|
|
}
|
|
case "allow_apple_id":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_apple_id: %w", err)
|
|
}
|
|
a.AllowAppleID = value
|
|
case "allow_google_id":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_google_id: %w", err)
|
|
}
|
|
a.AllowGoogleID = value
|
|
case "code_info":
|
|
if err := a.CodeInfo.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err)
|
|
}
|
|
case "email_address_reset_state":
|
|
value, err := DecodeTDLibJSONEmailAddressResetState(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err)
|
|
}
|
|
a.EmailAddressResetState = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetAllowAppleID returns value of AllowAppleID field.
|
|
func (a *AuthorizationStateWaitEmailCode) GetAllowAppleID() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.AllowAppleID
|
|
}
|
|
|
|
// GetAllowGoogleID returns value of AllowGoogleID field.
|
|
func (a *AuthorizationStateWaitEmailCode) GetAllowGoogleID() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.AllowGoogleID
|
|
}
|
|
|
|
// GetCodeInfo returns value of CodeInfo field.
|
|
func (a *AuthorizationStateWaitEmailCode) GetCodeInfo() (value EmailAddressAuthenticationCodeInfo) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.CodeInfo
|
|
}
|
|
|
|
// GetEmailAddressResetState returns value of EmailAddressResetState field.
|
|
func (a *AuthorizationStateWaitEmailCode) GetEmailAddressResetState() (value EmailAddressResetStateClass) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.EmailAddressResetState
|
|
}
|
|
|
|
// AuthorizationStateWaitCode represents TL type `authorizationStateWaitCode#3234501`.
|
|
type AuthorizationStateWaitCode struct {
|
|
// Information about the authorization code that was sent
|
|
CodeInfo AuthenticationCodeInfo
|
|
}
|
|
|
|
// AuthorizationStateWaitCodeTypeID is TL type id of AuthorizationStateWaitCode.
|
|
const AuthorizationStateWaitCodeTypeID = 0x3234501
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitCode) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitCode.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitCode{}
|
|
_ bin.Decoder = &AuthorizationStateWaitCode{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitCode{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitCode{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitCode{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitCode) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.CodeInfo.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitCode) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitCode(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitCode
|
|
return fmt.Sprintf("AuthorizationStateWaitCode%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitCode) TypeID() uint32 {
|
|
return AuthorizationStateWaitCodeTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitCode) TypeName() string {
|
|
return "authorizationStateWaitCode"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitCode) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitCode",
|
|
ID: AuthorizationStateWaitCodeTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "CodeInfo",
|
|
SchemaName: "code_info",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitCode) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitCode#3234501 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitCodeTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitCode) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitCode#3234501 as nil")
|
|
}
|
|
if err := a.CodeInfo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitCode#3234501: field code_info: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitCode) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitCode#3234501 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitCodeTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitCode) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitCode#3234501 to nil")
|
|
}
|
|
{
|
|
if err := a.CodeInfo.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: field code_info: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitCode) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitCode#3234501 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitCode")
|
|
b.Comma()
|
|
b.FieldStart("code_info")
|
|
if err := a.CodeInfo.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitCode#3234501: field code_info: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitCode) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitCode#3234501 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitCode"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: %w", err)
|
|
}
|
|
case "code_info":
|
|
if err := a.CodeInfo.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: field code_info: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetCodeInfo returns value of CodeInfo field.
|
|
func (a *AuthorizationStateWaitCode) GetCodeInfo() (value AuthenticationCodeInfo) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.CodeInfo
|
|
}
|
|
|
|
// AuthorizationStateWaitOtherDeviceConfirmation represents TL type `authorizationStateWaitOtherDeviceConfirmation#334518ea`.
|
|
type AuthorizationStateWaitOtherDeviceConfirmation struct {
|
|
// A tg:// URL for the QR code. The link will be updated frequently
|
|
Link string
|
|
}
|
|
|
|
// AuthorizationStateWaitOtherDeviceConfirmationTypeID is TL type id of AuthorizationStateWaitOtherDeviceConfirmation.
|
|
const AuthorizationStateWaitOtherDeviceConfirmationTypeID = 0x334518ea
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitOtherDeviceConfirmation) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitOtherDeviceConfirmation.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
_ bin.Decoder = &AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.Link == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitOtherDeviceConfirmation(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitOtherDeviceConfirmation
|
|
return fmt.Sprintf("AuthorizationStateWaitOtherDeviceConfirmation%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitOtherDeviceConfirmation) TypeID() uint32 {
|
|
return AuthorizationStateWaitOtherDeviceConfirmationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitOtherDeviceConfirmation) TypeName() string {
|
|
return "authorizationStateWaitOtherDeviceConfirmation"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitOtherDeviceConfirmation",
|
|
ID: AuthorizationStateWaitOtherDeviceConfirmationTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "Link",
|
|
SchemaName: "link",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitOtherDeviceConfirmation#334518ea as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitOtherDeviceConfirmationTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitOtherDeviceConfirmation#334518ea as nil")
|
|
}
|
|
b.PutString(a.Link)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitOtherDeviceConfirmation#334518ea to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitOtherDeviceConfirmationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitOtherDeviceConfirmation#334518ea to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: field link: %w", err)
|
|
}
|
|
a.Link = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitOtherDeviceConfirmation#334518ea as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitOtherDeviceConfirmation")
|
|
b.Comma()
|
|
b.FieldStart("link")
|
|
b.PutString(a.Link)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitOtherDeviceConfirmation#334518ea to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitOtherDeviceConfirmation"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: %w", err)
|
|
}
|
|
case "link":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: field link: %w", err)
|
|
}
|
|
a.Link = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetLink returns value of Link field.
|
|
func (a *AuthorizationStateWaitOtherDeviceConfirmation) GetLink() (value string) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.Link
|
|
}
|
|
|
|
// AuthorizationStateWaitRegistration represents TL type `authorizationStateWaitRegistration#20cdaeaf`.
|
|
type AuthorizationStateWaitRegistration struct {
|
|
// Telegram terms of service
|
|
TermsOfService TermsOfService
|
|
}
|
|
|
|
// AuthorizationStateWaitRegistrationTypeID is TL type id of AuthorizationStateWaitRegistration.
|
|
const AuthorizationStateWaitRegistrationTypeID = 0x20cdaeaf
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitRegistration) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitRegistration.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitRegistration{}
|
|
_ bin.Decoder = &AuthorizationStateWaitRegistration{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitRegistration{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitRegistration{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitRegistration{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitRegistration) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.TermsOfService.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitRegistration) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitRegistration(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitRegistration
|
|
return fmt.Sprintf("AuthorizationStateWaitRegistration%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitRegistration) TypeID() uint32 {
|
|
return AuthorizationStateWaitRegistrationTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitRegistration) TypeName() string {
|
|
return "authorizationStateWaitRegistration"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitRegistration) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitRegistration",
|
|
ID: AuthorizationStateWaitRegistrationTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "TermsOfService",
|
|
SchemaName: "terms_of_service",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitRegistration) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitRegistration#20cdaeaf as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitRegistrationTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitRegistration) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitRegistration#20cdaeaf as nil")
|
|
}
|
|
if err := a.TermsOfService.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitRegistration) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitRegistration#20cdaeaf to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitRegistrationTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitRegistration) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitRegistration#20cdaeaf to nil")
|
|
}
|
|
{
|
|
if err := a.TermsOfService.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitRegistration) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitRegistration#20cdaeaf as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitRegistration")
|
|
b.Comma()
|
|
b.FieldStart("terms_of_service")
|
|
if err := a.TermsOfService.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitRegistration) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitRegistration#20cdaeaf to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitRegistration"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: %w", err)
|
|
}
|
|
case "terms_of_service":
|
|
if err := a.TermsOfService.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetTermsOfService returns value of TermsOfService field.
|
|
func (a *AuthorizationStateWaitRegistration) GetTermsOfService() (value TermsOfService) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.TermsOfService
|
|
}
|
|
|
|
// AuthorizationStateWaitPassword represents TL type `authorizationStateWaitPassword#6b09dce`.
|
|
type AuthorizationStateWaitPassword struct {
|
|
// Hint for the password; may be empty
|
|
PasswordHint string
|
|
// True, if a recovery email address has been set up
|
|
HasRecoveryEmailAddress bool
|
|
// True, if some Telegram Passport elements were saved
|
|
HasPassportData bool
|
|
// Pattern of the email address to which the recovery email was sent; empty until a
|
|
// recovery email has been sent
|
|
RecoveryEmailAddressPattern string
|
|
}
|
|
|
|
// AuthorizationStateWaitPasswordTypeID is TL type id of AuthorizationStateWaitPassword.
|
|
const AuthorizationStateWaitPasswordTypeID = 0x6b09dce
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateWaitPassword) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateWaitPassword.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateWaitPassword{}
|
|
_ bin.Decoder = &AuthorizationStateWaitPassword{}
|
|
_ bin.BareEncoder = &AuthorizationStateWaitPassword{}
|
|
_ bin.BareDecoder = &AuthorizationStateWaitPassword{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateWaitPassword{}
|
|
)
|
|
|
|
func (a *AuthorizationStateWaitPassword) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.PasswordHint == "") {
|
|
return false
|
|
}
|
|
if !(a.HasRecoveryEmailAddress == false) {
|
|
return false
|
|
}
|
|
if !(a.HasPassportData == false) {
|
|
return false
|
|
}
|
|
if !(a.RecoveryEmailAddressPattern == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateWaitPassword) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateWaitPassword(nil)"
|
|
}
|
|
type Alias AuthorizationStateWaitPassword
|
|
return fmt.Sprintf("AuthorizationStateWaitPassword%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateWaitPassword) TypeID() uint32 {
|
|
return AuthorizationStateWaitPasswordTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateWaitPassword) TypeName() string {
|
|
return "authorizationStateWaitPassword"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateWaitPassword) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateWaitPassword",
|
|
ID: AuthorizationStateWaitPasswordTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "PasswordHint",
|
|
SchemaName: "password_hint",
|
|
},
|
|
{
|
|
Name: "HasRecoveryEmailAddress",
|
|
SchemaName: "has_recovery_email_address",
|
|
},
|
|
{
|
|
Name: "HasPassportData",
|
|
SchemaName: "has_passport_data",
|
|
},
|
|
{
|
|
Name: "RecoveryEmailAddressPattern",
|
|
SchemaName: "recovery_email_address_pattern",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateWaitPassword) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPassword#6b09dce as nil")
|
|
}
|
|
b.PutID(AuthorizationStateWaitPasswordTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateWaitPassword) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPassword#6b09dce as nil")
|
|
}
|
|
b.PutString(a.PasswordHint)
|
|
b.PutBool(a.HasRecoveryEmailAddress)
|
|
b.PutBool(a.HasPassportData)
|
|
b.PutString(a.RecoveryEmailAddressPattern)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateWaitPassword) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPassword#6b09dce to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateWaitPasswordTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateWaitPassword) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPassword#6b09dce to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field password_hint: %w", err)
|
|
}
|
|
a.PasswordHint = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_recovery_email_address: %w", err)
|
|
}
|
|
a.HasRecoveryEmailAddress = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_passport_data: %w", err)
|
|
}
|
|
a.HasPassportData = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field recovery_email_address_pattern: %w", err)
|
|
}
|
|
a.RecoveryEmailAddressPattern = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateWaitPassword) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateWaitPassword#6b09dce as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateWaitPassword")
|
|
b.Comma()
|
|
b.FieldStart("password_hint")
|
|
b.PutString(a.PasswordHint)
|
|
b.Comma()
|
|
b.FieldStart("has_recovery_email_address")
|
|
b.PutBool(a.HasRecoveryEmailAddress)
|
|
b.Comma()
|
|
b.FieldStart("has_passport_data")
|
|
b.PutBool(a.HasPassportData)
|
|
b.Comma()
|
|
b.FieldStart("recovery_email_address_pattern")
|
|
b.PutString(a.RecoveryEmailAddressPattern)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateWaitPassword) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateWaitPassword#6b09dce to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateWaitPassword"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: %w", err)
|
|
}
|
|
case "password_hint":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field password_hint: %w", err)
|
|
}
|
|
a.PasswordHint = value
|
|
case "has_recovery_email_address":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_recovery_email_address: %w", err)
|
|
}
|
|
a.HasRecoveryEmailAddress = value
|
|
case "has_passport_data":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_passport_data: %w", err)
|
|
}
|
|
a.HasPassportData = value
|
|
case "recovery_email_address_pattern":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field recovery_email_address_pattern: %w", err)
|
|
}
|
|
a.RecoveryEmailAddressPattern = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetPasswordHint returns value of PasswordHint field.
|
|
func (a *AuthorizationStateWaitPassword) GetPasswordHint() (value string) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.PasswordHint
|
|
}
|
|
|
|
// GetHasRecoveryEmailAddress returns value of HasRecoveryEmailAddress field.
|
|
func (a *AuthorizationStateWaitPassword) GetHasRecoveryEmailAddress() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.HasRecoveryEmailAddress
|
|
}
|
|
|
|
// GetHasPassportData returns value of HasPassportData field.
|
|
func (a *AuthorizationStateWaitPassword) GetHasPassportData() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.HasPassportData
|
|
}
|
|
|
|
// GetRecoveryEmailAddressPattern returns value of RecoveryEmailAddressPattern field.
|
|
func (a *AuthorizationStateWaitPassword) GetRecoveryEmailAddressPattern() (value string) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.RecoveryEmailAddressPattern
|
|
}
|
|
|
|
// AuthorizationStateReady represents TL type `authorizationStateReady#92a21447`.
|
|
type AuthorizationStateReady struct {
|
|
}
|
|
|
|
// AuthorizationStateReadyTypeID is TL type id of AuthorizationStateReady.
|
|
const AuthorizationStateReadyTypeID = 0x92a21447
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateReady) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateReady.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateReady{}
|
|
_ bin.Decoder = &AuthorizationStateReady{}
|
|
_ bin.BareEncoder = &AuthorizationStateReady{}
|
|
_ bin.BareDecoder = &AuthorizationStateReady{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateReady{}
|
|
)
|
|
|
|
func (a *AuthorizationStateReady) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateReady) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateReady(nil)"
|
|
}
|
|
type Alias AuthorizationStateReady
|
|
return fmt.Sprintf("AuthorizationStateReady%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateReady) TypeID() uint32 {
|
|
return AuthorizationStateReadyTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateReady) TypeName() string {
|
|
return "authorizationStateReady"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateReady) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateReady",
|
|
ID: AuthorizationStateReadyTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateReady) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateReady#92a21447 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateReadyTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateReady) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateReady#92a21447 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateReady) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateReady#92a21447 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateReadyTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateReady#92a21447: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateReady) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateReady#92a21447 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateReady) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateReady#92a21447 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateReady")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateReady) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateReady#92a21447 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateReady"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateReady#92a21447: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// AuthorizationStateLoggingOut represents TL type `authorizationStateLoggingOut#934b576`.
|
|
type AuthorizationStateLoggingOut struct {
|
|
}
|
|
|
|
// AuthorizationStateLoggingOutTypeID is TL type id of AuthorizationStateLoggingOut.
|
|
const AuthorizationStateLoggingOutTypeID = 0x934b576
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateLoggingOut) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateLoggingOut.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateLoggingOut{}
|
|
_ bin.Decoder = &AuthorizationStateLoggingOut{}
|
|
_ bin.BareEncoder = &AuthorizationStateLoggingOut{}
|
|
_ bin.BareDecoder = &AuthorizationStateLoggingOut{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateLoggingOut{}
|
|
)
|
|
|
|
func (a *AuthorizationStateLoggingOut) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateLoggingOut) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateLoggingOut(nil)"
|
|
}
|
|
type Alias AuthorizationStateLoggingOut
|
|
return fmt.Sprintf("AuthorizationStateLoggingOut%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateLoggingOut) TypeID() uint32 {
|
|
return AuthorizationStateLoggingOutTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateLoggingOut) TypeName() string {
|
|
return "authorizationStateLoggingOut"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateLoggingOut) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateLoggingOut",
|
|
ID: AuthorizationStateLoggingOutTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateLoggingOut) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateLoggingOut#934b576 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateLoggingOutTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateLoggingOut) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateLoggingOut#934b576 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateLoggingOut) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateLoggingOut#934b576 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateLoggingOutTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateLoggingOut#934b576: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateLoggingOut) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateLoggingOut#934b576 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateLoggingOut) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateLoggingOut#934b576 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateLoggingOut")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateLoggingOut) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateLoggingOut#934b576 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateLoggingOut"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateLoggingOut#934b576: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// AuthorizationStateClosing represents TL type `authorizationStateClosing#1a93364f`.
|
|
type AuthorizationStateClosing struct {
|
|
}
|
|
|
|
// AuthorizationStateClosingTypeID is TL type id of AuthorizationStateClosing.
|
|
const AuthorizationStateClosingTypeID = 0x1a93364f
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateClosing) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateClosing.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateClosing{}
|
|
_ bin.Decoder = &AuthorizationStateClosing{}
|
|
_ bin.BareEncoder = &AuthorizationStateClosing{}
|
|
_ bin.BareDecoder = &AuthorizationStateClosing{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateClosing{}
|
|
)
|
|
|
|
func (a *AuthorizationStateClosing) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateClosing) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateClosing(nil)"
|
|
}
|
|
type Alias AuthorizationStateClosing
|
|
return fmt.Sprintf("AuthorizationStateClosing%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateClosing) TypeID() uint32 {
|
|
return AuthorizationStateClosingTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateClosing) TypeName() string {
|
|
return "authorizationStateClosing"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateClosing) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateClosing",
|
|
ID: AuthorizationStateClosingTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateClosing) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateClosing#1a93364f as nil")
|
|
}
|
|
b.PutID(AuthorizationStateClosingTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateClosing) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateClosing#1a93364f as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateClosing) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateClosing#1a93364f to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateClosingTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateClosing#1a93364f: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateClosing) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateClosing#1a93364f to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateClosing) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateClosing#1a93364f as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateClosing")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateClosing) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateClosing#1a93364f to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateClosing"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateClosing#1a93364f: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// AuthorizationStateClosed represents TL type `authorizationStateClosed#5af5a360`.
|
|
type AuthorizationStateClosed struct {
|
|
}
|
|
|
|
// AuthorizationStateClosedTypeID is TL type id of AuthorizationStateClosed.
|
|
const AuthorizationStateClosedTypeID = 0x5af5a360
|
|
|
|
// construct implements constructor of AuthorizationStateClass.
|
|
func (a AuthorizationStateClosed) construct() AuthorizationStateClass { return &a }
|
|
|
|
// Ensuring interfaces in compile-time for AuthorizationStateClosed.
|
|
var (
|
|
_ bin.Encoder = &AuthorizationStateClosed{}
|
|
_ bin.Decoder = &AuthorizationStateClosed{}
|
|
_ bin.BareEncoder = &AuthorizationStateClosed{}
|
|
_ bin.BareDecoder = &AuthorizationStateClosed{}
|
|
|
|
_ AuthorizationStateClass = &AuthorizationStateClosed{}
|
|
)
|
|
|
|
func (a *AuthorizationStateClosed) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AuthorizationStateClosed) String() string {
|
|
if a == nil {
|
|
return "AuthorizationStateClosed(nil)"
|
|
}
|
|
type Alias AuthorizationStateClosed
|
|
return fmt.Sprintf("AuthorizationStateClosed%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AuthorizationStateClosed) TypeID() uint32 {
|
|
return AuthorizationStateClosedTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AuthorizationStateClosed) TypeName() string {
|
|
return "authorizationStateClosed"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AuthorizationStateClosed) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "authorizationStateClosed",
|
|
ID: AuthorizationStateClosedTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AuthorizationStateClosed) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateClosed#5af5a360 as nil")
|
|
}
|
|
b.PutID(AuthorizationStateClosedTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AuthorizationStateClosed) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateClosed#5af5a360 as nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AuthorizationStateClosed) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateClosed#5af5a360 to nil")
|
|
}
|
|
if err := b.ConsumeID(AuthorizationStateClosedTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateClosed#5af5a360: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AuthorizationStateClosed) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateClosed#5af5a360 to nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AuthorizationStateClosed) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode authorizationStateClosed#5af5a360 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("authorizationStateClosed")
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AuthorizationStateClosed) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode authorizationStateClosed#5af5a360 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("authorizationStateClosed"); err != nil {
|
|
return fmt.Errorf("unable to decode authorizationStateClosed#5af5a360: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// AuthorizationStateClassName is schema name of AuthorizationStateClass.
|
|
const AuthorizationStateClassName = "AuthorizationState"
|
|
|
|
// AuthorizationStateClass represents AuthorizationState generic type.
|
|
//
|
|
// Example:
|
|
//
|
|
// g, err := tdapi.DecodeAuthorizationState(buf)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// switch v := g.(type) {
|
|
// case *tdapi.AuthorizationStateWaitTdlibParameters: // authorizationStateWaitTdlibParameters#35ecf25c
|
|
// case *tdapi.AuthorizationStateWaitPhoneNumber: // authorizationStateWaitPhoneNumber#124354e3
|
|
// case *tdapi.AuthorizationStateWaitPremiumPurchase: // authorizationStateWaitPremiumPurchase#cc977b41
|
|
// case *tdapi.AuthorizationStateWaitEmailAddress: // authorizationStateWaitEmailAddress#3e0471c7
|
|
// case *tdapi.AuthorizationStateWaitEmailCode: // authorizationStateWaitEmailCode#909f025b
|
|
// case *tdapi.AuthorizationStateWaitCode: // authorizationStateWaitCode#3234501
|
|
// case *tdapi.AuthorizationStateWaitOtherDeviceConfirmation: // authorizationStateWaitOtherDeviceConfirmation#334518ea
|
|
// case *tdapi.AuthorizationStateWaitRegistration: // authorizationStateWaitRegistration#20cdaeaf
|
|
// case *tdapi.AuthorizationStateWaitPassword: // authorizationStateWaitPassword#6b09dce
|
|
// case *tdapi.AuthorizationStateReady: // authorizationStateReady#92a21447
|
|
// case *tdapi.AuthorizationStateLoggingOut: // authorizationStateLoggingOut#934b576
|
|
// case *tdapi.AuthorizationStateClosing: // authorizationStateClosing#1a93364f
|
|
// case *tdapi.AuthorizationStateClosed: // authorizationStateClosed#5af5a360
|
|
// default: panic(v)
|
|
// }
|
|
type AuthorizationStateClass interface {
|
|
bin.Encoder
|
|
bin.Decoder
|
|
bin.BareEncoder
|
|
bin.BareDecoder
|
|
construct() AuthorizationStateClass
|
|
|
|
// 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
|
|
|
|
EncodeTDLibJSON(b tdjson.Encoder) error
|
|
DecodeTDLibJSON(b tdjson.Decoder) error
|
|
}
|
|
|
|
// DecodeAuthorizationState implements binary de-serialization for AuthorizationStateClass.
|
|
func DecodeAuthorizationState(buf *bin.Buffer) (AuthorizationStateClass, error) {
|
|
id, err := buf.PeekID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case AuthorizationStateWaitTdlibParametersTypeID:
|
|
// Decoding authorizationStateWaitTdlibParameters#35ecf25c.
|
|
v := AuthorizationStateWaitTdlibParameters{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitPhoneNumberTypeID:
|
|
// Decoding authorizationStateWaitPhoneNumber#124354e3.
|
|
v := AuthorizationStateWaitPhoneNumber{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitPremiumPurchaseTypeID:
|
|
// Decoding authorizationStateWaitPremiumPurchase#cc977b41.
|
|
v := AuthorizationStateWaitPremiumPurchase{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitEmailAddressTypeID:
|
|
// Decoding authorizationStateWaitEmailAddress#3e0471c7.
|
|
v := AuthorizationStateWaitEmailAddress{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitEmailCodeTypeID:
|
|
// Decoding authorizationStateWaitEmailCode#909f025b.
|
|
v := AuthorizationStateWaitEmailCode{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitCodeTypeID:
|
|
// Decoding authorizationStateWaitCode#3234501.
|
|
v := AuthorizationStateWaitCode{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitOtherDeviceConfirmationTypeID:
|
|
// Decoding authorizationStateWaitOtherDeviceConfirmation#334518ea.
|
|
v := AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitRegistrationTypeID:
|
|
// Decoding authorizationStateWaitRegistration#20cdaeaf.
|
|
v := AuthorizationStateWaitRegistration{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateWaitPasswordTypeID:
|
|
// Decoding authorizationStateWaitPassword#6b09dce.
|
|
v := AuthorizationStateWaitPassword{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateReadyTypeID:
|
|
// Decoding authorizationStateReady#92a21447.
|
|
v := AuthorizationStateReady{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateLoggingOutTypeID:
|
|
// Decoding authorizationStateLoggingOut#934b576.
|
|
v := AuthorizationStateLoggingOut{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateClosingTypeID:
|
|
// Decoding authorizationStateClosing#1a93364f.
|
|
v := AuthorizationStateClosing{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case AuthorizationStateClosedTypeID:
|
|
// Decoding authorizationStateClosed#5af5a360.
|
|
v := AuthorizationStateClosed{}
|
|
if err := v.Decode(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", bin.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// DecodeTDLibJSONAuthorizationState implements binary de-serialization for AuthorizationStateClass.
|
|
func DecodeTDLibJSONAuthorizationState(buf tdjson.Decoder) (AuthorizationStateClass, error) {
|
|
id, err := buf.FindTypeID()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
switch id {
|
|
case "authorizationStateWaitTdlibParameters":
|
|
// Decoding authorizationStateWaitTdlibParameters#35ecf25c.
|
|
v := AuthorizationStateWaitTdlibParameters{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitPhoneNumber":
|
|
// Decoding authorizationStateWaitPhoneNumber#124354e3.
|
|
v := AuthorizationStateWaitPhoneNumber{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitPremiumPurchase":
|
|
// Decoding authorizationStateWaitPremiumPurchase#cc977b41.
|
|
v := AuthorizationStateWaitPremiumPurchase{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitEmailAddress":
|
|
// Decoding authorizationStateWaitEmailAddress#3e0471c7.
|
|
v := AuthorizationStateWaitEmailAddress{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitEmailCode":
|
|
// Decoding authorizationStateWaitEmailCode#909f025b.
|
|
v := AuthorizationStateWaitEmailCode{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitCode":
|
|
// Decoding authorizationStateWaitCode#3234501.
|
|
v := AuthorizationStateWaitCode{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitOtherDeviceConfirmation":
|
|
// Decoding authorizationStateWaitOtherDeviceConfirmation#334518ea.
|
|
v := AuthorizationStateWaitOtherDeviceConfirmation{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitRegistration":
|
|
// Decoding authorizationStateWaitRegistration#20cdaeaf.
|
|
v := AuthorizationStateWaitRegistration{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateWaitPassword":
|
|
// Decoding authorizationStateWaitPassword#6b09dce.
|
|
v := AuthorizationStateWaitPassword{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateReady":
|
|
// Decoding authorizationStateReady#92a21447.
|
|
v := AuthorizationStateReady{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateLoggingOut":
|
|
// Decoding authorizationStateLoggingOut#934b576.
|
|
v := AuthorizationStateLoggingOut{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateClosing":
|
|
// Decoding authorizationStateClosing#1a93364f.
|
|
v := AuthorizationStateClosing{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
case "authorizationStateClosed":
|
|
// Decoding authorizationStateClosed#5af5a360.
|
|
v := AuthorizationStateClosed{}
|
|
if err := v.DecodeTDLibJSON(buf); err != nil {
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err)
|
|
}
|
|
return &v, nil
|
|
default:
|
|
return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", tdjson.NewUnexpectedID(id))
|
|
}
|
|
}
|
|
|
|
// AuthorizationState boxes the AuthorizationStateClass providing a helper.
|
|
type AuthorizationStateBox struct {
|
|
AuthorizationState AuthorizationStateClass
|
|
}
|
|
|
|
// Decode implements bin.Decoder for AuthorizationStateBox.
|
|
func (b *AuthorizationStateBox) Decode(buf *bin.Buffer) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode AuthorizationStateBox to nil")
|
|
}
|
|
v, err := DecodeAuthorizationState(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.AuthorizationState = v
|
|
return nil
|
|
}
|
|
|
|
// Encode implements bin.Encode for AuthorizationStateBox.
|
|
func (b *AuthorizationStateBox) Encode(buf *bin.Buffer) error {
|
|
if b == nil || b.AuthorizationState == nil {
|
|
return fmt.Errorf("unable to encode AuthorizationStateClass as nil")
|
|
}
|
|
return b.AuthorizationState.Encode(buf)
|
|
}
|
|
|
|
// DecodeTDLibJSON implements bin.Decoder for AuthorizationStateBox.
|
|
func (b *AuthorizationStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
|
if b == nil {
|
|
return fmt.Errorf("unable to decode AuthorizationStateBox to nil")
|
|
}
|
|
v, err := DecodeTDLibJSONAuthorizationState(buf)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode boxed value: %w", err)
|
|
}
|
|
b.AuthorizationState = v
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements bin.Encode for AuthorizationStateBox.
|
|
func (b *AuthorizationStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
|
if b == nil || b.AuthorizationState == nil {
|
|
return fmt.Errorf("unable to encode AuthorizationStateClass as nil")
|
|
}
|
|
return b.AuthorizationState.EncodeTDLibJSON(buf)
|
|
}
|