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