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 WalletSecretPhraseParts struct {
Token string
DCs []int
}
const WalletSecretPhrasePartsTypeID = 0xe6d0ef01
var (
_ bin .Encoder = &WalletSecretPhraseParts {}
_ bin .Decoder = &WalletSecretPhraseParts {}
_ bin .BareEncoder = &WalletSecretPhraseParts {}
_ bin .BareDecoder = &WalletSecretPhraseParts {}
)
func (s *WalletSecretPhraseParts ) Zero () bool {
if s == nil {
return true
}
if !(s .Token == "" ) {
return false
}
if !(s .DCs == nil ) {
return false
}
return true
}
func (s *WalletSecretPhraseParts ) String () string {
if s == nil {
return "WalletSecretPhraseParts(nil)"
}
type Alias WalletSecretPhraseParts
return fmt .Sprintf ("WalletSecretPhraseParts%+v" , Alias (*s ))
}
func (s *WalletSecretPhraseParts ) FillFrom (from interface {
GetToken () (value string )
GetDCs () (value []int )
}) {
s .Token = from .GetToken ()
s .DCs = from .GetDCs ()
}
func (*WalletSecretPhraseParts ) TypeID () uint32 {
return WalletSecretPhrasePartsTypeID
}
func (*WalletSecretPhraseParts ) TypeName () string {
return "wallet.secretPhraseParts"
}
func (s *WalletSecretPhraseParts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.secretPhraseParts" ,
ID : WalletSecretPhrasePartsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Token" ,
SchemaName : "token" ,
},
{
Name : "DCs" ,
SchemaName : "dcs" ,
},
}
return typ
}
func (s *WalletSecretPhraseParts ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode wallet.secretPhraseParts#e6d0ef01 as nil" )
}
b .PutID (WalletSecretPhrasePartsTypeID )
return s .EncodeBare (b )
}
func (s *WalletSecretPhraseParts ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode wallet.secretPhraseParts#e6d0ef01 as nil" )
}
b .PutString (s .Token )
b .PutVectorHeader (len (s .DCs ))
for _ , v := range s .DCs {
b .PutInt (v )
}
return nil
}
func (s *WalletSecretPhraseParts ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode wallet.secretPhraseParts#e6d0ef01 to nil" )
}
if err := b .ConsumeID (WalletSecretPhrasePartsTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.secretPhraseParts#e6d0ef01: %w" , err )
}
return s .DecodeBare (b )
}
func (s *WalletSecretPhraseParts ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode wallet.secretPhraseParts#e6d0ef01 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.secretPhraseParts#e6d0ef01: field token: %w" , err )
}
s .Token = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.secretPhraseParts#e6d0ef01: field dcs: %w" , err )
}
if headerLen > 0 {
s .DCs = make ([]int , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.secretPhraseParts#e6d0ef01: field dcs: %w" , err )
}
s .DCs = append (s .DCs , value )
}
}
return nil
}
func (s *WalletSecretPhraseParts ) GetToken () (value string ) {
if s == nil {
return
}
return s .Token
}
func (s *WalletSecretPhraseParts ) GetDCs () (value []int ) {
if s == nil {
return
}
return s .DCs
}
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 .