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 WalletProofChallenge struct {
Payload string
Expires int
Domain string
}
const WalletProofChallengeTypeID = 0x99e41707
var (
_ bin .Encoder = &WalletProofChallenge {}
_ bin .Decoder = &WalletProofChallenge {}
_ bin .BareEncoder = &WalletProofChallenge {}
_ bin .BareDecoder = &WalletProofChallenge {}
)
func (p *WalletProofChallenge ) Zero () bool {
if p == nil {
return true
}
if !(p .Payload == "" ) {
return false
}
if !(p .Expires == 0 ) {
return false
}
if !(p .Domain == "" ) {
return false
}
return true
}
func (p *WalletProofChallenge ) String () string {
if p == nil {
return "WalletProofChallenge(nil)"
}
type Alias WalletProofChallenge
return fmt .Sprintf ("WalletProofChallenge%+v" , Alias (*p ))
}
func (p *WalletProofChallenge ) FillFrom (from interface {
GetPayload () (value string )
GetExpires () (value int )
GetDomain () (value string )
}) {
p .Payload = from .GetPayload ()
p .Expires = from .GetExpires ()
p .Domain = from .GetDomain ()
}
func (*WalletProofChallenge ) TypeID () uint32 {
return WalletProofChallengeTypeID
}
func (*WalletProofChallenge ) TypeName () string {
return "wallet.proofChallenge"
}
func (p *WalletProofChallenge ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.proofChallenge" ,
ID : WalletProofChallengeTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Payload" ,
SchemaName : "payload" ,
},
{
Name : "Expires" ,
SchemaName : "expires" ,
},
{
Name : "Domain" ,
SchemaName : "domain" ,
},
}
return typ
}
func (p *WalletProofChallenge ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode wallet.proofChallenge#99e41707 as nil" )
}
b .PutID (WalletProofChallengeTypeID )
return p .EncodeBare (b )
}
func (p *WalletProofChallenge ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode wallet.proofChallenge#99e41707 as nil" )
}
b .PutString (p .Payload )
b .PutInt (p .Expires )
b .PutString (p .Domain )
return nil
}
func (p *WalletProofChallenge ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode wallet.proofChallenge#99e41707 to nil" )
}
if err := b .ConsumeID (WalletProofChallengeTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.proofChallenge#99e41707: %w" , err )
}
return p .DecodeBare (b )
}
func (p *WalletProofChallenge ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode wallet.proofChallenge#99e41707 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.proofChallenge#99e41707: field payload: %w" , err )
}
p .Payload = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.proofChallenge#99e41707: field expires: %w" , err )
}
p .Expires = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.proofChallenge#99e41707: field domain: %w" , err )
}
p .Domain = value
}
return nil
}
func (p *WalletProofChallenge ) GetPayload () (value string ) {
if p == nil {
return
}
return p .Payload
}
func (p *WalletProofChallenge ) GetExpires () (value int ) {
if p == nil {
return
}
return p .Expires
}
func (p *WalletProofChallenge ) GetDomain () (value string ) {
if p == nil {
return
}
return p .Domain
}
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 .