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 PaymentsPaymentResult struct {
Updates UpdatesClass
}
const PaymentsPaymentResultTypeID = 0x4e5f810d
func (p PaymentsPaymentResult ) construct () PaymentsPaymentResultClass { return &p }
var (
_ bin .Encoder = &PaymentsPaymentResult {}
_ bin .Decoder = &PaymentsPaymentResult {}
_ bin .BareEncoder = &PaymentsPaymentResult {}
_ bin .BareDecoder = &PaymentsPaymentResult {}
_ PaymentsPaymentResultClass = &PaymentsPaymentResult {}
)
func (p *PaymentsPaymentResult ) Zero () bool {
if p == nil {
return true
}
if !(p .Updates == nil ) {
return false
}
return true
}
func (p *PaymentsPaymentResult ) String () string {
if p == nil {
return "PaymentsPaymentResult(nil)"
}
type Alias PaymentsPaymentResult
return fmt .Sprintf ("PaymentsPaymentResult%+v" , Alias (*p ))
}
func (p *PaymentsPaymentResult ) FillFrom (from interface {
GetUpdates () (value UpdatesClass )
}) {
p .Updates = from .GetUpdates ()
}
func (*PaymentsPaymentResult ) TypeID () uint32 {
return PaymentsPaymentResultTypeID
}
func (*PaymentsPaymentResult ) TypeName () string {
return "payments.paymentResult"
}
func (p *PaymentsPaymentResult ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.paymentResult" ,
ID : PaymentsPaymentResultTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Updates" ,
SchemaName : "updates" ,
},
}
return typ
}
func (p *PaymentsPaymentResult ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode payments.paymentResult#4e5f810d as nil" )
}
b .PutID (PaymentsPaymentResultTypeID )
return p .EncodeBare (b )
}
func (p *PaymentsPaymentResult ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode payments.paymentResult#4e5f810d as nil" )
}
if p .Updates == nil {
return fmt .Errorf ("unable to encode payments.paymentResult#4e5f810d: field updates is nil" )
}
if err := p .Updates .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.paymentResult#4e5f810d: field updates: %w" , err )
}
return nil
}
func (p *PaymentsPaymentResult ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode payments.paymentResult#4e5f810d to nil" )
}
if err := b .ConsumeID (PaymentsPaymentResultTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.paymentResult#4e5f810d: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PaymentsPaymentResult ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode payments.paymentResult#4e5f810d to nil" )
}
{
value , err := DecodeUpdates (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.paymentResult#4e5f810d: field updates: %w" , err )
}
p .Updates = value
}
return nil
}
func (p *PaymentsPaymentResult ) GetUpdates () (value UpdatesClass ) {
if p == nil {
return
}
return p .Updates
}
type PaymentsPaymentVerificationNeeded struct {
URL string
}
const PaymentsPaymentVerificationNeededTypeID = 0xd8411139
func (p PaymentsPaymentVerificationNeeded ) construct () PaymentsPaymentResultClass { return &p }
var (
_ bin .Encoder = &PaymentsPaymentVerificationNeeded {}
_ bin .Decoder = &PaymentsPaymentVerificationNeeded {}
_ bin .BareEncoder = &PaymentsPaymentVerificationNeeded {}
_ bin .BareDecoder = &PaymentsPaymentVerificationNeeded {}
_ PaymentsPaymentResultClass = &PaymentsPaymentVerificationNeeded {}
)
func (p *PaymentsPaymentVerificationNeeded ) Zero () bool {
if p == nil {
return true
}
if !(p .URL == "" ) {
return false
}
return true
}
func (p *PaymentsPaymentVerificationNeeded ) String () string {
if p == nil {
return "PaymentsPaymentVerificationNeeded(nil)"
}
type Alias PaymentsPaymentVerificationNeeded
return fmt .Sprintf ("PaymentsPaymentVerificationNeeded%+v" , Alias (*p ))
}
func (p *PaymentsPaymentVerificationNeeded ) FillFrom (from interface {
GetURL () (value string )
}) {
p .URL = from .GetURL ()
}
func (*PaymentsPaymentVerificationNeeded ) TypeID () uint32 {
return PaymentsPaymentVerificationNeededTypeID
}
func (*PaymentsPaymentVerificationNeeded ) TypeName () string {
return "payments.paymentVerificationNeeded"
}
func (p *PaymentsPaymentVerificationNeeded ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.paymentVerificationNeeded" ,
ID : PaymentsPaymentVerificationNeededTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (p *PaymentsPaymentVerificationNeeded ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode payments.paymentVerificationNeeded#d8411139 as nil" )
}
b .PutID (PaymentsPaymentVerificationNeededTypeID )
return p .EncodeBare (b )
}
func (p *PaymentsPaymentVerificationNeeded ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode payments.paymentVerificationNeeded#d8411139 as nil" )
}
b .PutString (p .URL )
return nil
}
func (p *PaymentsPaymentVerificationNeeded ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode payments.paymentVerificationNeeded#d8411139 to nil" )
}
if err := b .ConsumeID (PaymentsPaymentVerificationNeededTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.paymentVerificationNeeded#d8411139: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PaymentsPaymentVerificationNeeded ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode payments.paymentVerificationNeeded#d8411139 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.paymentVerificationNeeded#d8411139: field url: %w" , err )
}
p .URL = value
}
return nil
}
func (p *PaymentsPaymentVerificationNeeded ) GetURL () (value string ) {
if p == nil {
return
}
return p .URL
}
const PaymentsPaymentResultClassName = "payments.PaymentResult"
type PaymentsPaymentResultClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PaymentsPaymentResultClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodePaymentsPaymentResult (buf *bin .Buffer ) (PaymentsPaymentResultClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PaymentsPaymentResultTypeID :
v := PaymentsPaymentResult {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PaymentsPaymentResultClass: %w" , err )
}
return &v , nil
case PaymentsPaymentVerificationNeededTypeID :
v := PaymentsPaymentVerificationNeeded {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PaymentsPaymentResultClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PaymentsPaymentResultClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PaymentsPaymentResultBox struct {
PaymentResult PaymentsPaymentResultClass
}
func (b *PaymentsPaymentResultBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PaymentsPaymentResultBox to nil" )
}
v , err := DecodePaymentsPaymentResult (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .PaymentResult = v
return nil
}
func (b *PaymentsPaymentResultBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .PaymentResult == nil {
return fmt .Errorf ("unable to encode PaymentsPaymentResultClass as nil" )
}
return b .PaymentResult .Encode (buf )
}
The pages are generated with Golds v0.6.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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .