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 AccountGetTmpPasswordRequest struct {
Password InputCheckPasswordSRPClass
Period int
}
const AccountGetTmpPasswordRequestTypeID = 0x449e0b51
var (
_ bin .Encoder = &AccountGetTmpPasswordRequest {}
_ bin .Decoder = &AccountGetTmpPasswordRequest {}
_ bin .BareEncoder = &AccountGetTmpPasswordRequest {}
_ bin .BareDecoder = &AccountGetTmpPasswordRequest {}
)
func (g *AccountGetTmpPasswordRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Password == nil ) {
return false
}
if !(g .Period == 0 ) {
return false
}
return true
}
func (g *AccountGetTmpPasswordRequest ) String () string {
if g == nil {
return "AccountGetTmpPasswordRequest(nil)"
}
type Alias AccountGetTmpPasswordRequest
return fmt .Sprintf ("AccountGetTmpPasswordRequest%+v" , Alias (*g ))
}
func (g *AccountGetTmpPasswordRequest ) FillFrom (from interface {
GetPassword () (value InputCheckPasswordSRPClass )
GetPeriod () (value int )
}) {
g .Password = from .GetPassword ()
g .Period = from .GetPeriod ()
}
func (*AccountGetTmpPasswordRequest ) TypeID () uint32 {
return AccountGetTmpPasswordRequestTypeID
}
func (*AccountGetTmpPasswordRequest ) TypeName () string {
return "account.getTmpPassword"
}
func (g *AccountGetTmpPasswordRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.getTmpPassword" ,
ID : AccountGetTmpPasswordRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Password" ,
SchemaName : "password" ,
},
{
Name : "Period" ,
SchemaName : "period" ,
},
}
return typ
}
func (g *AccountGetTmpPasswordRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getTmpPassword#449e0b51 as nil" )
}
b .PutID (AccountGetTmpPasswordRequestTypeID )
return g .EncodeBare (b )
}
func (g *AccountGetTmpPasswordRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode account.getTmpPassword#449e0b51 as nil" )
}
if g .Password == nil {
return fmt .Errorf ("unable to encode account.getTmpPassword#449e0b51: field password is nil" )
}
if err := g .Password .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.getTmpPassword#449e0b51: field password: %w" , err )
}
b .PutInt (g .Period )
return nil
}
func (g *AccountGetTmpPasswordRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getTmpPassword#449e0b51 to nil" )
}
if err := b .ConsumeID (AccountGetTmpPasswordRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.getTmpPassword#449e0b51: %w" , err )
}
return g .DecodeBare (b )
}
func (g *AccountGetTmpPasswordRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode account.getTmpPassword#449e0b51 to nil" )
}
{
value , err := DecodeInputCheckPasswordSRP (b )
if err != nil {
return fmt .Errorf ("unable to decode account.getTmpPassword#449e0b51: field password: %w" , err )
}
g .Password = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode account.getTmpPassword#449e0b51: field period: %w" , err )
}
g .Period = value
}
return nil
}
func (g *AccountGetTmpPasswordRequest ) GetPassword () (value InputCheckPasswordSRPClass ) {
if g == nil {
return
}
return g .Password
}
func (g *AccountGetTmpPasswordRequest ) GetPeriod () (value int ) {
if g == nil {
return
}
return g .Period
}
func (g *AccountGetTmpPasswordRequest ) GetPasswordAsNotEmpty () (*InputCheckPasswordSRP , bool ) {
return g .Password .AsNotEmpty ()
}
func (c *Client ) AccountGetTmpPassword (ctx context .Context , request *AccountGetTmpPasswordRequest ) (*AccountTmpPassword , error ) {
var result AccountTmpPassword
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .