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 WalletTonConnectCreateSessionRequest struct {
DappClientID string
ManifestURL string
}
const WalletTonConnectCreateSessionRequestTypeID = 0xcc931046
var (
_ bin .Encoder = &WalletTonConnectCreateSessionRequest {}
_ bin .Decoder = &WalletTonConnectCreateSessionRequest {}
_ bin .BareEncoder = &WalletTonConnectCreateSessionRequest {}
_ bin .BareDecoder = &WalletTonConnectCreateSessionRequest {}
)
func (t *WalletTonConnectCreateSessionRequest ) Zero () bool {
if t == nil {
return true
}
if !(t .DappClientID == "" ) {
return false
}
if !(t .ManifestURL == "" ) {
return false
}
return true
}
func (t *WalletTonConnectCreateSessionRequest ) String () string {
if t == nil {
return "WalletTonConnectCreateSessionRequest(nil)"
}
type Alias WalletTonConnectCreateSessionRequest
return fmt .Sprintf ("WalletTonConnectCreateSessionRequest%+v" , Alias (*t ))
}
func (t *WalletTonConnectCreateSessionRequest ) FillFrom (from interface {
GetDappClientID () (value string )
GetManifestURL () (value string )
}) {
t .DappClientID = from .GetDappClientID ()
t .ManifestURL = from .GetManifestURL ()
}
func (*WalletTonConnectCreateSessionRequest ) TypeID () uint32 {
return WalletTonConnectCreateSessionRequestTypeID
}
func (*WalletTonConnectCreateSessionRequest ) TypeName () string {
return "wallet.tonConnectCreateSession"
}
func (t *WalletTonConnectCreateSessionRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.tonConnectCreateSession" ,
ID : WalletTonConnectCreateSessionRequestTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DappClientID" ,
SchemaName : "dapp_client_id" ,
},
{
Name : "ManifestURL" ,
SchemaName : "manifest_url" ,
},
}
return typ
}
func (t *WalletTonConnectCreateSessionRequest ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectCreateSession#cc931046 as nil" )
}
b .PutID (WalletTonConnectCreateSessionRequestTypeID )
return t .EncodeBare (b )
}
func (t *WalletTonConnectCreateSessionRequest ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode wallet.tonConnectCreateSession#cc931046 as nil" )
}
b .PutString (t .DappClientID )
b .PutString (t .ManifestURL )
return nil
}
func (t *WalletTonConnectCreateSessionRequest ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectCreateSession#cc931046 to nil" )
}
if err := b .ConsumeID (WalletTonConnectCreateSessionRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCreateSession#cc931046: %w" , err )
}
return t .DecodeBare (b )
}
func (t *WalletTonConnectCreateSessionRequest ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode wallet.tonConnectCreateSession#cc931046 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCreateSession#cc931046: field dapp_client_id: %w" , err )
}
t .DappClientID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.tonConnectCreateSession#cc931046: field manifest_url: %w" , err )
}
t .ManifestURL = value
}
return nil
}
func (t *WalletTonConnectCreateSessionRequest ) GetDappClientID () (value string ) {
if t == nil {
return
}
return t .DappClientID
}
func (t *WalletTonConnectCreateSessionRequest ) GetManifestURL () (value string ) {
if t == nil {
return
}
return t .ManifestURL
}
func (c *Client ) WalletTonConnectCreateSession (ctx context .Context , request *WalletTonConnectCreateSessionRequest ) (*TonConnectSession , error ) {
var result TonConnectSession
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 .