package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type AccountResetPasswordFailedWait struct {
RetryDate int
}
const AccountResetPasswordFailedWaitTypeID = 0xe3779861
func (r AccountResetPasswordFailedWait ) construct () AccountResetPasswordResultClass { return &r }
var (
_ bin .Encoder = &AccountResetPasswordFailedWait {}
_ bin .Decoder = &AccountResetPasswordFailedWait {}
_ bin .BareEncoder = &AccountResetPasswordFailedWait {}
_ bin .BareDecoder = &AccountResetPasswordFailedWait {}
_ AccountResetPasswordResultClass = &AccountResetPasswordFailedWait {}
)
func (r *AccountResetPasswordFailedWait ) Zero () bool {
if r == nil {
return true
}
if !(r .RetryDate == 0 ) {
return false
}
return true
}
func (r *AccountResetPasswordFailedWait ) String () string {
if r == nil {
return "AccountResetPasswordFailedWait(nil)"
}
type Alias AccountResetPasswordFailedWait
return fmt .Sprintf ("AccountResetPasswordFailedWait%+v" , Alias (*r ))
}
func (r *AccountResetPasswordFailedWait ) FillFrom (from interface {
GetRetryDate () (value int )
}) {
r .RetryDate = from .GetRetryDate ()
}
func (*AccountResetPasswordFailedWait ) TypeID () uint32 {
return AccountResetPasswordFailedWaitTypeID
}
func (*AccountResetPasswordFailedWait ) TypeName () string {
return "account.resetPasswordFailedWait"
}
func (r *AccountResetPasswordFailedWait ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.resetPasswordFailedWait" ,
ID : AccountResetPasswordFailedWaitTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "RetryDate" ,
SchemaName : "retry_date" ,
},
}
return typ
}
func (r *AccountResetPasswordFailedWait ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetPasswordFailedWait#e3779861 as nil" )
}
b .PutID (AccountResetPasswordFailedWaitTypeID )
return r .EncodeBare (b )
}
func (r *AccountResetPasswordFailedWait ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetPasswordFailedWait#e3779861 as nil" )
}
b .PutInt (r .RetryDate )
return nil
}
func (r *AccountResetPasswordFailedWait ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetPasswordFailedWait#e3779861 to nil" )
}
if err := b .ConsumeID (AccountResetPasswordFailedWaitTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.resetPasswordFailedWait#e3779861: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AccountResetPasswordFailedWait ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetPasswordFailedWait#e3779861 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode account.resetPasswordFailedWait#e3779861: field retry_date: %w" , err )
}
r .RetryDate = value
}
return nil
}
func (r *AccountResetPasswordFailedWait ) GetRetryDate () (value int ) {
if r == nil {
return
}
return r .RetryDate
}
type AccountResetPasswordRequestedWait struct {
UntilDate int
}
const AccountResetPasswordRequestedWaitTypeID = 0xe9effc7d
func (r AccountResetPasswordRequestedWait ) construct () AccountResetPasswordResultClass { return &r }
var (
_ bin .Encoder = &AccountResetPasswordRequestedWait {}
_ bin .Decoder = &AccountResetPasswordRequestedWait {}
_ bin .BareEncoder = &AccountResetPasswordRequestedWait {}
_ bin .BareDecoder = &AccountResetPasswordRequestedWait {}
_ AccountResetPasswordResultClass = &AccountResetPasswordRequestedWait {}
)
func (r *AccountResetPasswordRequestedWait ) Zero () bool {
if r == nil {
return true
}
if !(r .UntilDate == 0 ) {
return false
}
return true
}
func (r *AccountResetPasswordRequestedWait ) String () string {
if r == nil {
return "AccountResetPasswordRequestedWait(nil)"
}
type Alias AccountResetPasswordRequestedWait
return fmt .Sprintf ("AccountResetPasswordRequestedWait%+v" , Alias (*r ))
}
func (r *AccountResetPasswordRequestedWait ) FillFrom (from interface {
GetUntilDate () (value int )
}) {
r .UntilDate = from .GetUntilDate ()
}
func (*AccountResetPasswordRequestedWait ) TypeID () uint32 {
return AccountResetPasswordRequestedWaitTypeID
}
func (*AccountResetPasswordRequestedWait ) TypeName () string {
return "account.resetPasswordRequestedWait"
}
func (r *AccountResetPasswordRequestedWait ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.resetPasswordRequestedWait" ,
ID : AccountResetPasswordRequestedWaitTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UntilDate" ,
SchemaName : "until_date" ,
},
}
return typ
}
func (r *AccountResetPasswordRequestedWait ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetPasswordRequestedWait#e9effc7d as nil" )
}
b .PutID (AccountResetPasswordRequestedWaitTypeID )
return r .EncodeBare (b )
}
func (r *AccountResetPasswordRequestedWait ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetPasswordRequestedWait#e9effc7d as nil" )
}
b .PutInt (r .UntilDate )
return nil
}
func (r *AccountResetPasswordRequestedWait ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetPasswordRequestedWait#e9effc7d to nil" )
}
if err := b .ConsumeID (AccountResetPasswordRequestedWaitTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.resetPasswordRequestedWait#e9effc7d: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AccountResetPasswordRequestedWait ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetPasswordRequestedWait#e9effc7d to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode account.resetPasswordRequestedWait#e9effc7d: field until_date: %w" , err )
}
r .UntilDate = value
}
return nil
}
func (r *AccountResetPasswordRequestedWait ) GetUntilDate () (value int ) {
if r == nil {
return
}
return r .UntilDate
}
type AccountResetPasswordOk struct {
}
const AccountResetPasswordOkTypeID = 0xe926d63e
func (r AccountResetPasswordOk ) construct () AccountResetPasswordResultClass { return &r }
var (
_ bin .Encoder = &AccountResetPasswordOk {}
_ bin .Decoder = &AccountResetPasswordOk {}
_ bin .BareEncoder = &AccountResetPasswordOk {}
_ bin .BareDecoder = &AccountResetPasswordOk {}
_ AccountResetPasswordResultClass = &AccountResetPasswordOk {}
)
func (r *AccountResetPasswordOk ) Zero () bool {
if r == nil {
return true
}
return true
}
func (r *AccountResetPasswordOk ) String () string {
if r == nil {
return "AccountResetPasswordOk(nil)"
}
type Alias AccountResetPasswordOk
return fmt .Sprintf ("AccountResetPasswordOk%+v" , Alias (*r ))
}
func (*AccountResetPasswordOk ) TypeID () uint32 {
return AccountResetPasswordOkTypeID
}
func (*AccountResetPasswordOk ) TypeName () string {
return "account.resetPasswordOk"
}
func (r *AccountResetPasswordOk ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.resetPasswordOk" ,
ID : AccountResetPasswordOkTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (r *AccountResetPasswordOk ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetPasswordOk#e926d63e as nil" )
}
b .PutID (AccountResetPasswordOkTypeID )
return r .EncodeBare (b )
}
func (r *AccountResetPasswordOk ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.resetPasswordOk#e926d63e as nil" )
}
return nil
}
func (r *AccountResetPasswordOk ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetPasswordOk#e926d63e to nil" )
}
if err := b .ConsumeID (AccountResetPasswordOkTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.resetPasswordOk#e926d63e: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AccountResetPasswordOk ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.resetPasswordOk#e926d63e to nil" )
}
return nil
}
const AccountResetPasswordResultClassName = "account.ResetPasswordResult"
type AccountResetPasswordResultClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () AccountResetPasswordResultClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeAccountResetPasswordResult (buf *bin .Buffer ) (AccountResetPasswordResultClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case AccountResetPasswordFailedWaitTypeID :
v := AccountResetPasswordFailedWait {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountResetPasswordResultClass: %w" , err )
}
return &v , nil
case AccountResetPasswordRequestedWaitTypeID :
v := AccountResetPasswordRequestedWait {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountResetPasswordResultClass: %w" , err )
}
return &v , nil
case AccountResetPasswordOkTypeID :
v := AccountResetPasswordOk {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode AccountResetPasswordResultClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode AccountResetPasswordResultClass: %w" , bin .NewUnexpectedID (id ))
}
}
type AccountResetPasswordResultBox struct {
ResetPasswordResult AccountResetPasswordResultClass
}
func (b *AccountResetPasswordResultBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode AccountResetPasswordResultBox to nil" )
}
v , err := DecodeAccountResetPasswordResult (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .ResetPasswordResult = v
return nil
}
func (b *AccountResetPasswordResultBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .ResetPasswordResult == nil {
return fmt .Errorf ("unable to encode AccountResetPasswordResultClass as nil" )
}
return b .ResetPasswordResult .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .