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 PaymentsGetStarGiftWithdrawalURLRequest struct {
Flags bin .Fields
Stargift InputSavedStarGiftClass
TmpPassword []byte
}
const PaymentsGetStarGiftWithdrawalURLRequestTypeID = 0xc8ca817b
var (
_ bin .Encoder = &PaymentsGetStarGiftWithdrawalURLRequest {}
_ bin .Decoder = &PaymentsGetStarGiftWithdrawalURLRequest {}
_ bin .BareEncoder = &PaymentsGetStarGiftWithdrawalURLRequest {}
_ bin .BareDecoder = &PaymentsGetStarGiftWithdrawalURLRequest {}
)
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Stargift == nil ) {
return false
}
if !(g .TmpPassword == nil ) {
return false
}
return true
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) String () string {
if g == nil {
return "PaymentsGetStarGiftWithdrawalURLRequest(nil)"
}
type Alias PaymentsGetStarGiftWithdrawalURLRequest
return fmt .Sprintf ("PaymentsGetStarGiftWithdrawalURLRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) FillFrom (from interface {
GetStargift () (value InputSavedStarGiftClass )
GetTmpPassword () (value []byte )
}) {
g .Stargift = from .GetStargift ()
g .TmpPassword = from .GetTmpPassword ()
}
func (*PaymentsGetStarGiftWithdrawalURLRequest ) TypeID () uint32 {
return PaymentsGetStarGiftWithdrawalURLRequestTypeID
}
func (*PaymentsGetStarGiftWithdrawalURLRequest ) TypeName () string {
return "payments.getStarGiftWithdrawalUrl"
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getStarGiftWithdrawalUrl" ,
ID : PaymentsGetStarGiftWithdrawalURLRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Stargift" ,
SchemaName : "stargift" ,
},
{
Name : "TmpPassword" ,
SchemaName : "tmp_password" ,
},
}
return typ
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) SetFlags () {
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarGiftWithdrawalUrl#c8ca817b as nil" )
}
b .PutID (PaymentsGetStarGiftWithdrawalURLRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarGiftWithdrawalUrl#c8ca817b as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarGiftWithdrawalUrl#c8ca817b: field flags: %w" , err )
}
if g .Stargift == nil {
return fmt .Errorf ("unable to encode payments.getStarGiftWithdrawalUrl#c8ca817b: field stargift is nil" )
}
if err := g .Stargift .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarGiftWithdrawalUrl#c8ca817b: field stargift: %w" , err )
}
b .PutBytes (g .TmpPassword )
return nil
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarGiftWithdrawalUrl#c8ca817b to nil" )
}
if err := b .ConsumeID (PaymentsGetStarGiftWithdrawalURLRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftWithdrawalUrl#c8ca817b: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarGiftWithdrawalUrl#c8ca817b to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftWithdrawalUrl#c8ca817b: field flags: %w" , err )
}
}
{
value , err := DecodeInputSavedStarGift (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftWithdrawalUrl#c8ca817b: field stargift: %w" , err )
}
g .Stargift = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarGiftWithdrawalUrl#c8ca817b: field tmp_password: %w" , err )
}
g .TmpPassword = value
}
return nil
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) GetStargift () (value InputSavedStarGiftClass ) {
if g == nil {
return
}
return g .Stargift
}
func (g *PaymentsGetStarGiftWithdrawalURLRequest ) GetTmpPassword () (value []byte ) {
if g == nil {
return
}
return g .TmpPassword
}
func (c *Client ) PaymentsGetStarGiftWithdrawalURL (ctx context .Context , request *PaymentsGetStarGiftWithdrawalURLRequest ) (*PaymentsStarGiftWithdrawalURL , error ) {
var result PaymentsStarGiftWithdrawalURL
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 .