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 WalletTonConnectGetPendingRequest struct {
Flags bin .Fields
DappClientID string
SessionID int64
}
const WalletTonConnectGetPendingRequestTypeID = 0x11aee065
var (
_ bin .Encoder = &WalletTonConnectGetPendingRequest {}
_ bin .Decoder = &WalletTonConnectGetPendingRequest {}
_ bin .BareEncoder = &WalletTonConnectGetPendingRequest {}
_ bin .BareDecoder = &WalletTonConnectGetPendingRequest {}
)
func (t *WalletTonConnectGetPendingRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Flags .Zero ()) {
return false
}
if !(t .DappClientID == "" ) {
return false
}
if !(t .SessionID == 0 ) {
return false
}
return true
}
func (t *WalletTonConnectGetPendingRequest ) String () string {
if t == nil {
return "WalletTonConnectGetPendingRequest(nil)"
}
type Alias WalletTonConnectGetPendingRequest
return fmt .Sprintf ("WalletTonConnectGetPendingRequest%+v" , Alias (*t ))
}
func (t *WalletTonConnectGetPendingRequest ) FillFrom (from interface {
GetDappClientID () (value string , ok bool )
GetSessionID () (value int64 , ok bool )
}) {
if val , ok := from .GetDappClientID (); ok {
t .DappClientID = val
}
if val , ok := from .GetSessionID (); ok {
t .SessionID = val
}
}
func (*WalletTonConnectGetPendingRequest ) TypeID () uint32 {
return WalletTonConnectGetPendingRequestTypeID
}
func (*WalletTonConnectGetPendingRequest ) TypeName () string {
return "wallet.tonConnectGetPending"
}
func (t *WalletTonConnectGetPendingRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.tonConnectGetPending" ,
ID : WalletTonConnectGetPendingRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DappClientID" ,
SchemaName : "dapp_client_id" ,
Null : !t .Flags .Has (0 ),
},
{
Name : "SessionID" ,
SchemaName : "session_id" ,
Null : !t .Flags .Has (1 ),
},
}
return typ
}
func (t *WalletTonConnectGetPendingRequest ) SetFlags () {
if !(t .DappClientID == "" ) {
t .Flags .Set (0 )
}
if !(t .SessionID == 0 ) {
t .Flags .Set (1 )
}
}
func (t *WalletTonConnectGetPendingRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectGetPending#11aee065 as nil" )
}
b .PutID (WalletTonConnectGetPendingRequestTypeID )
return t .EncodeBare (b )
}
func (t *WalletTonConnectGetPendingRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectGetPending#11aee065 as nil" )
}
t .SetFlags ()
if err := t .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.tonConnectGetPending#11aee065: field flags: %w" , err )
}
if t .Flags .Has (0 ) {
b .PutString (t .DappClientID )
}
if t .Flags .Has (1 ) {
b .PutLong (t .SessionID )
}
return nil
}
func (t *WalletTonConnectGetPendingRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectGetPending#11aee065 to nil" )
}
if err := b .ConsumeID (WalletTonConnectGetPendingRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectGetPending#11aee065: %w" , err )
}
return t .DecodeBare (b )
}
func (t *WalletTonConnectGetPendingRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectGetPending#11aee065 to nil" )
}
{
if err := t .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectGetPending#11aee065: field flags: %w" , err )
}
}
if t .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectGetPending#11aee065: field dapp_client_id: %w" , err )
}
t .DappClientID = value
}
if t .Flags .Has (1 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectGetPending#11aee065: field session_id: %w" , err )
}
t .SessionID = value
}
return nil
}
func (t *WalletTonConnectGetPendingRequest ) SetDappClientID (value string ) {
t .Flags .Set (0 )
t .DappClientID = value
}
func (t *WalletTonConnectGetPendingRequest ) GetDappClientID () (value string , ok bool ) {
if t == nil {
return
}
if !t .Flags .Has (0 ) {
return value , false
}
return t .DappClientID , true
}
func (t *WalletTonConnectGetPendingRequest ) SetSessionID (value int64 ) {
t .Flags .Set (1 )
t .SessionID = value
}
func (t *WalletTonConnectGetPendingRequest ) GetSessionID () (value int64 , ok bool ) {
if t == nil {
return
}
if !t .Flags .Has (1 ) {
return value , false
}
return t .SessionID , true
}
func (c *Client ) WalletTonConnectGetPending (ctx context .Context , request *WalletTonConnectGetPendingRequest ) (*WalletTonConnectPending , error ) {
var result WalletTonConnectPending
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 .