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 WalletTonConnectPending struct {
Session TonConnectSession
Requests []TonConnectRequest
}
const WalletTonConnectPendingTypeID = 0x85c0f124
var (
_ bin .Encoder = &WalletTonConnectPending {}
_ bin .Decoder = &WalletTonConnectPending {}
_ bin .BareEncoder = &WalletTonConnectPending {}
_ bin .BareDecoder = &WalletTonConnectPending {}
)
func (t *WalletTonConnectPending ) Zero () bool {
if t == nil {
return true
}
if !(t .Session .Zero ()) {
return false
}
if !(t .Requests == nil ) {
return false
}
return true
}
func (t *WalletTonConnectPending ) String () string {
if t == nil {
return "WalletTonConnectPending(nil)"
}
type Alias WalletTonConnectPending
return fmt .Sprintf ("WalletTonConnectPending%+v" , Alias (*t ))
}
func (t *WalletTonConnectPending ) FillFrom (from interface {
GetSession () (value TonConnectSession )
GetRequests () (value []TonConnectRequest )
}) {
t .Session = from .GetSession ()
t .Requests = from .GetRequests ()
}
func (*WalletTonConnectPending ) TypeID () uint32 {
return WalletTonConnectPendingTypeID
}
func (*WalletTonConnectPending ) TypeName () string {
return "wallet.tonConnectPending"
}
func (t *WalletTonConnectPending ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.tonConnectPending" ,
ID : WalletTonConnectPendingTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Session" ,
SchemaName : "session" ,
},
{
Name : "Requests" ,
SchemaName : "requests" ,
},
}
return typ
}
func (t *WalletTonConnectPending ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectPending#85c0f124 as nil" )
}
b .PutID (WalletTonConnectPendingTypeID )
return t .EncodeBare (b )
}
func (t *WalletTonConnectPending ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectPending#85c0f124 as nil" )
}
if err := t .Session .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.tonConnectPending#85c0f124: field session: %w" , err )
}
b .PutVectorHeader (len (t .Requests ))
for idx , v := range t .Requests {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.tonConnectPending#85c0f124: field requests element with index %d: %w" , idx , err )
}
}
return nil
}
func (t *WalletTonConnectPending ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectPending#85c0f124 to nil" )
}
if err := b .ConsumeID (WalletTonConnectPendingTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectPending#85c0f124: %w" , err )
}
return t .DecodeBare (b )
}
func (t *WalletTonConnectPending ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectPending#85c0f124 to nil" )
}
{
if err := t .Session .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectPending#85c0f124: field session: %w" , err )
}
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectPending#85c0f124: field requests: %w" , err )
}
if headerLen > 0 {
t .Requests = make ([]TonConnectRequest , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value TonConnectRequest
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectPending#85c0f124: field requests: %w" , err )
}
t .Requests = append (t .Requests , value )
}
}
return nil
}
func (t *WalletTonConnectPending ) GetSession () (value TonConnectSession ) {
if t == nil {
return
}
return t .Session
}
func (t *WalletTonConnectPending ) GetRequests () (value []TonConnectRequest ) {
if t == nil {
return
}
return t .Requests
}
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 .