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 AccountTmpPassword struct {
TmpPassword []byte
ValidUntil int
}
const AccountTmpPasswordTypeID = 0xdb64fd34
var (
_ bin .Encoder = &AccountTmpPassword {}
_ bin .Decoder = &AccountTmpPassword {}
_ bin .BareEncoder = &AccountTmpPassword {}
_ bin .BareDecoder = &AccountTmpPassword {}
)
func (t *AccountTmpPassword ) Zero () bool {
if t == nil {
return true
}
if !(t .TmpPassword == nil ) {
return false
}
if !(t .ValidUntil == 0 ) {
return false
}
return true
}
func (t *AccountTmpPassword ) String () string {
if t == nil {
return "AccountTmpPassword(nil)"
}
type Alias AccountTmpPassword
return fmt .Sprintf ("AccountTmpPassword%+v" , Alias (*t ))
}
func (t *AccountTmpPassword ) FillFrom (from interface {
GetTmpPassword () (value []byte )
GetValidUntil () (value int )
}) {
t .TmpPassword = from .GetTmpPassword ()
t .ValidUntil = from .GetValidUntil ()
}
func (*AccountTmpPassword ) TypeID () uint32 {
return AccountTmpPasswordTypeID
}
func (*AccountTmpPassword ) TypeName () string {
return "account.tmpPassword"
}
func (t *AccountTmpPassword ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.tmpPassword" ,
ID : AccountTmpPasswordTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "TmpPassword" ,
SchemaName : "tmp_password" ,
},
{
Name : "ValidUntil" ,
SchemaName : "valid_until" ,
},
}
return typ
}
func (t *AccountTmpPassword ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode account.tmpPassword#db64fd34 as nil" )
}
b .PutID (AccountTmpPasswordTypeID )
return t .EncodeBare (b )
}
func (t *AccountTmpPassword ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode account.tmpPassword#db64fd34 as nil" )
}
b .PutBytes (t .TmpPassword )
b .PutInt (t .ValidUntil )
return nil
}
func (t *AccountTmpPassword ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode account.tmpPassword#db64fd34 to nil" )
}
if err := b .ConsumeID (AccountTmpPasswordTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.tmpPassword#db64fd34: %w" , err )
}
return t .DecodeBare (b )
}
func (t *AccountTmpPassword ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode account.tmpPassword#db64fd34 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode account.tmpPassword#db64fd34: field tmp_password: %w" , err )
}
t .TmpPassword = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode account.tmpPassword#db64fd34: field valid_until: %w" , err )
}
t .ValidUntil = value
}
return nil
}
func (t *AccountTmpPassword ) GetTmpPassword () (value []byte ) {
if t == nil {
return
}
return t .TmpPassword
}
func (t *AccountTmpPassword ) GetValidUntil () (value int ) {
if t == nil {
return
}
return t .ValidUntil
}
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 .