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 InputTonConnectOauthSession struct {
SessionID int64
ChallengeAnswer []byte
Body []byte
Proof WalletOwnershipProof
}
const InputTonConnectOauthSessionTypeID = 0x629f66ce
var (
_ bin .Encoder = &InputTonConnectOauthSession {}
_ bin .Decoder = &InputTonConnectOauthSession {}
_ bin .BareEncoder = &InputTonConnectOauthSession {}
_ bin .BareDecoder = &InputTonConnectOauthSession {}
)
func (i *InputTonConnectOauthSession ) Zero () bool {
if i == nil {
return true
}
if !(i .SessionID == 0 ) {
return false
}
if !(i .ChallengeAnswer == nil ) {
return false
}
if !(i .Body == nil ) {
return false
}
if !(i .Proof .Zero ()) {
return false
}
return true
}
func (i *InputTonConnectOauthSession ) String () string {
if i == nil {
return "InputTonConnectOauthSession(nil)"
}
type Alias InputTonConnectOauthSession
return fmt .Sprintf ("InputTonConnectOauthSession%+v" , Alias (*i ))
}
func (i *InputTonConnectOauthSession ) FillFrom (from interface {
GetSessionID () (value int64 )
GetChallengeAnswer () (value []byte )
GetBody () (value []byte )
GetProof () (value WalletOwnershipProof )
}) {
i .SessionID = from .GetSessionID ()
i .ChallengeAnswer = from .GetChallengeAnswer ()
i .Body = from .GetBody ()
i .Proof = from .GetProof ()
}
func (*InputTonConnectOauthSession ) TypeID () uint32 {
return InputTonConnectOauthSessionTypeID
}
func (*InputTonConnectOauthSession ) TypeName () string {
return "inputTonConnectOauthSession"
}
func (i *InputTonConnectOauthSession ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "inputTonConnectOauthSession" ,
ID : InputTonConnectOauthSessionTypeID ,
}
if i == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SessionID" ,
SchemaName : "session_id" ,
},
{
Name : "ChallengeAnswer" ,
SchemaName : "challenge_answer" ,
},
{
Name : "Body" ,
SchemaName : "body" ,
},
{
Name : "Proof" ,
SchemaName : "proof" ,
},
}
return typ
}
func (i *InputTonConnectOauthSession ) Encode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputTonConnectOauthSession#629f66ce as nil" )
}
b .PutID (InputTonConnectOauthSessionTypeID )
return i .EncodeBare (b )
}
func (i *InputTonConnectOauthSession ) EncodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't encode inputTonConnectOauthSession#629f66ce as nil" )
}
b .PutLong (i .SessionID )
b .PutBytes (i .ChallengeAnswer )
b .PutBytes (i .Body )
if err := i .Proof .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode inputTonConnectOauthSession#629f66ce: field proof: %w" , err )
}
return nil
}
func (i *InputTonConnectOauthSession ) Decode (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputTonConnectOauthSession#629f66ce to nil" )
}
if err := b .ConsumeID (InputTonConnectOauthSessionTypeID ); err != nil {
return fmt .Errorf ("unable to decode inputTonConnectOauthSession#629f66ce: %w" , err )
}
return i .DecodeBare (b )
}
func (i *InputTonConnectOauthSession ) DecodeBare (b *bin .Buffer ) error {
if i == nil {
return fmt .Errorf ("can't decode inputTonConnectOauthSession#629f66ce to nil" )
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode inputTonConnectOauthSession#629f66ce: field session_id: %w" , err )
}
i .SessionID = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode inputTonConnectOauthSession#629f66ce: field challenge_answer: %w" , err )
}
i .ChallengeAnswer = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode inputTonConnectOauthSession#629f66ce: field body: %w" , err )
}
i .Body = value
}
{
if err := i .Proof .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode inputTonConnectOauthSession#629f66ce: field proof: %w" , err )
}
}
return nil
}
func (i *InputTonConnectOauthSession ) GetSessionID () (value int64 ) {
if i == nil {
return
}
return i .SessionID
}
func (i *InputTonConnectOauthSession ) GetChallengeAnswer () (value []byte ) {
if i == nil {
return
}
return i .ChallengeAnswer
}
func (i *InputTonConnectOauthSession ) GetBody () (value []byte ) {
if i == nil {
return
}
return i .Body
}
func (i *InputTonConnectOauthSession ) GetProof () (value WalletOwnershipProof ) {
if i == nil {
return
}
return i .Proof
}
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 .