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