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 WalletTonConnectCloseSessionRequest struct {
Flags bin .Fields
SessionID int64
Body []byte
}
const WalletTonConnectCloseSessionRequestTypeID = 0xd63f61ce
var (
_ bin .Encoder = &WalletTonConnectCloseSessionRequest {}
_ bin .Decoder = &WalletTonConnectCloseSessionRequest {}
_ bin .BareEncoder = &WalletTonConnectCloseSessionRequest {}
_ bin .BareDecoder = &WalletTonConnectCloseSessionRequest {}
)
func (t *WalletTonConnectCloseSessionRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .Flags .Zero ()) {
return false
}
if !(t .SessionID == 0 ) {
return false
}
if !(t .Body == nil ) {
return false
}
return true
}
func (t *WalletTonConnectCloseSessionRequest ) String () string {
if t == nil {
return "WalletTonConnectCloseSessionRequest(nil)"
}
type Alias WalletTonConnectCloseSessionRequest
return fmt .Sprintf ("WalletTonConnectCloseSessionRequest%+v" , Alias (*t ))
}
func (t *WalletTonConnectCloseSessionRequest ) FillFrom (from interface {
GetSessionID () (value int64 )
GetBody () (value []byte , ok bool )
}) {
t .SessionID = from .GetSessionID ()
if val , ok := from .GetBody (); ok {
t .Body = val
}
}
func (*WalletTonConnectCloseSessionRequest ) TypeID () uint32 {
return WalletTonConnectCloseSessionRequestTypeID
}
func (*WalletTonConnectCloseSessionRequest ) TypeName () string {
return "wallet.tonConnectCloseSession"
}
func (t *WalletTonConnectCloseSessionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.tonConnectCloseSession" ,
ID : WalletTonConnectCloseSessionRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SessionID" ,
SchemaName : "session_id" ,
},
{
Name : "Body" ,
SchemaName : "body" ,
Null : !t .Flags .Has (0 ),
},
}
return typ
}
func (t *WalletTonConnectCloseSessionRequest ) SetFlags () {
if !(t .Body == nil ) {
t .Flags .Set (0 )
}
}
func (t *WalletTonConnectCloseSessionRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectCloseSession#d63f61ce as nil" )
}
b .PutID (WalletTonConnectCloseSessionRequestTypeID )
return t .EncodeBare (b )
}
func (t *WalletTonConnectCloseSessionRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectCloseSession#d63f61ce as nil" )
}
t .SetFlags ()
if err := t .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode wallet.tonConnectCloseSession#d63f61ce: field flags: %w" , err )
}
b .PutLong (t .SessionID )
if t .Flags .Has (0 ) {
b .PutBytes (t .Body )
}
return nil
}
func (t *WalletTonConnectCloseSessionRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectCloseSession#d63f61ce to nil" )
}
if err := b .ConsumeID (WalletTonConnectCloseSessionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCloseSession#d63f61ce: %w" , err )
}
return t .DecodeBare (b )
}
func (t *WalletTonConnectCloseSessionRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectCloseSession#d63f61ce to nil" )
}
{
if err := t .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCloseSession#d63f61ce: field flags: %w" , err )
}
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCloseSession#d63f61ce: field session_id: %w" , err )
}
t .SessionID = value
}
if t .Flags .Has (0 ) {
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCloseSession#d63f61ce: field body: %w" , err )
}
t .Body = value
}
return nil
}
func (t *WalletTonConnectCloseSessionRequest ) GetSessionID () (value int64 ) {
if t == nil {
return
}
return t .SessionID
}
func (t *WalletTonConnectCloseSessionRequest ) SetBody (value []byte ) {
t .Flags .Set (0 )
t .Body = value
}
func (t *WalletTonConnectCloseSessionRequest ) GetBody () (value []byte , ok bool ) {
if t == nil {
return
}
if !t .Flags .Has (0 ) {
return value , false
}
return t .Body , true
}
func (c *Client ) WalletTonConnectCloseSession (ctx context .Context , request *WalletTonConnectCloseSessionRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .