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