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