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 WalletExportSecretPhraseRequest struct {
Flags bin .Fields
Password InputCheckPasswordSRPClass
}
const WalletExportSecretPhraseRequestTypeID = 0x9077c9ac
var (
_ bin .Encoder = &WalletExportSecretPhraseRequest {}
_ bin .Decoder = &WalletExportSecretPhraseRequest {}
_ bin .BareEncoder = &WalletExportSecretPhraseRequest {}
_ bin .BareDecoder = &WalletExportSecretPhraseRequest {}
)
func (e *WalletExportSecretPhraseRequest ) Zero () bool {
if e == nil {
return true
}
if !(e .Flags .Zero ()) {
return false
}
if !(e .Password == nil ) {
return false
}
return true
}
func (e *WalletExportSecretPhraseRequest ) String () string {
if e == nil {
return "WalletExportSecretPhraseRequest(nil)"
}
type Alias WalletExportSecretPhraseRequest
return fmt .Sprintf ("WalletExportSecretPhraseRequest%+v" , Alias (*e ))
}
func (e *WalletExportSecretPhraseRequest ) FillFrom (from interface {
GetPassword () (value InputCheckPasswordSRPClass , ok bool )
}) {
if val , ok := from .GetPassword (); ok {
e .Password = val
}
}
func (*WalletExportSecretPhraseRequest ) TypeID () uint32 {
return WalletExportSecretPhraseRequestTypeID
}
func (*WalletExportSecretPhraseRequest ) TypeName () string {
return "wallet.exportSecretPhrase"
}
func (e *WalletExportSecretPhraseRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.exportSecretPhrase" ,
ID : WalletExportSecretPhraseRequestTypeID ,
}
if e == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Password" ,
SchemaName : "password" ,
Null : !e .Flags .Has (0 ),
},
}
return typ
}
func (e *WalletExportSecretPhraseRequest ) SetFlags () {
if !(e .Password == nil ) {
e .Flags .Set (0 )
}
}
func (e *WalletExportSecretPhraseRequest ) Encode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode wallet.exportSecretPhrase#9077c9ac as nil" )
}
b .PutID (WalletExportSecretPhraseRequestTypeID )
return e .EncodeBare (b )
}
func (e *WalletExportSecretPhraseRequest ) EncodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't encode wallet.exportSecretPhrase#9077c9ac as nil" )
}
e .SetFlags ()
if err := e .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.exportSecretPhrase#9077c9ac: field flags: %w" , err )
}
if e .Flags .Has (0 ) {
if e .Password == nil {
return fmt .Errorf ("unable to encode wallet.exportSecretPhrase#9077c9ac: field password is nil" )
}
if err := e .Password .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.exportSecretPhrase#9077c9ac: field password: %w" , err )
}
}
return nil
}
func (e *WalletExportSecretPhraseRequest ) Decode (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode wallet.exportSecretPhrase#9077c9ac to nil" )
}
if err := b .ConsumeID (WalletExportSecretPhraseRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.exportSecretPhrase#9077c9ac: %w" , err )
}
return e .DecodeBare (b )
}
func (e *WalletExportSecretPhraseRequest ) DecodeBare (b *bin .Buffer ) error {
if e == nil {
return fmt .Errorf ("can't decode wallet.exportSecretPhrase#9077c9ac to nil" )
}
{
if err := e .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode wallet.exportSecretPhrase#9077c9ac: field flags: %w" , err )
}
}
if e .Flags .Has (0 ) {
value , err := DecodeInputCheckPasswordSRP (b )
if err != nil {
return fmt .Errorf ("unable to decode wallet.exportSecretPhrase#9077c9ac: field password: %w" , err )
}
e .Password = value
}
return nil
}
func (e *WalletExportSecretPhraseRequest ) SetPassword (value InputCheckPasswordSRPClass ) {
e .Flags .Set (0 )
e .Password = value
}
func (e *WalletExportSecretPhraseRequest ) GetPassword () (value InputCheckPasswordSRPClass , ok bool ) {
if e == nil {
return
}
if !e .Flags .Has (0 ) {
return value , false
}
return e .Password , true
}
func (e *WalletExportSecretPhraseRequest ) GetPasswordAsNotEmpty () (*InputCheckPasswordSRP , bool ) {
if value , ok := e .GetPassword (); ok {
return value .AsNotEmpty ()
}
return nil , false
}
func (c *Client ) WalletExportSecretPhrase (ctx context .Context , request *WalletExportSecretPhraseRequest ) (*WalletSecretPhraseParts , error ) {
var result WalletSecretPhraseParts
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .