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 PaymentsUpgradeStarGiftRequest struct {
Flags bin .Fields
KeepOriginalDetails bool
Stargift InputSavedStarGiftClass
}
const PaymentsUpgradeStarGiftRequestTypeID = 0xaed6e4f5
var (
_ bin .Encoder = &PaymentsUpgradeStarGiftRequest {}
_ bin .Decoder = &PaymentsUpgradeStarGiftRequest {}
_ bin .BareEncoder = &PaymentsUpgradeStarGiftRequest {}
_ bin .BareDecoder = &PaymentsUpgradeStarGiftRequest {}
)
func (u *PaymentsUpgradeStarGiftRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .Flags .Zero ()) {
return false
}
if !(u .KeepOriginalDetails == false ) {
return false
}
if !(u .Stargift == nil ) {
return false
}
return true
}
func (u *PaymentsUpgradeStarGiftRequest ) String () string {
if u == nil {
return "PaymentsUpgradeStarGiftRequest(nil)"
}
type Alias PaymentsUpgradeStarGiftRequest
return fmt .Sprintf ("PaymentsUpgradeStarGiftRequest%+v" , Alias (*u ))
}
func (u *PaymentsUpgradeStarGiftRequest ) FillFrom (from interface {
GetKeepOriginalDetails () (value bool )
GetStargift () (value InputSavedStarGiftClass )
}) {
u .KeepOriginalDetails = from .GetKeepOriginalDetails ()
u .Stargift = from .GetStargift ()
}
func (*PaymentsUpgradeStarGiftRequest ) TypeID () uint32 {
return PaymentsUpgradeStarGiftRequestTypeID
}
func (*PaymentsUpgradeStarGiftRequest ) TypeName () string {
return "payments.upgradeStarGift"
}
func (u *PaymentsUpgradeStarGiftRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.upgradeStarGift" ,
ID : PaymentsUpgradeStarGiftRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "KeepOriginalDetails" ,
SchemaName : "keep_original_details" ,
Null : !u .Flags .Has (0 ),
},
{
Name : "Stargift" ,
SchemaName : "stargift" ,
},
}
return typ
}
func (u *PaymentsUpgradeStarGiftRequest ) SetFlags () {
if !(u .KeepOriginalDetails == false ) {
u .Flags .Set (0 )
}
}
func (u *PaymentsUpgradeStarGiftRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode payments.upgradeStarGift#aed6e4f5 as nil" )
}
b .PutID (PaymentsUpgradeStarGiftRequestTypeID )
return u .EncodeBare (b )
}
func (u *PaymentsUpgradeStarGiftRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode payments.upgradeStarGift#aed6e4f5 as nil" )
}
u .SetFlags ()
if err := u .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.upgradeStarGift#aed6e4f5: field flags: %w" , err )
}
if u .Stargift == nil {
return fmt .Errorf ("unable to encode payments.upgradeStarGift#aed6e4f5: field stargift is nil" )
}
if err := u .Stargift .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.upgradeStarGift#aed6e4f5: field stargift: %w" , err )
}
return nil
}
func (u *PaymentsUpgradeStarGiftRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode payments.upgradeStarGift#aed6e4f5 to nil" )
}
if err := b .ConsumeID (PaymentsUpgradeStarGiftRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.upgradeStarGift#aed6e4f5: %w" , err )
}
return u .DecodeBare (b )
}
func (u *PaymentsUpgradeStarGiftRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode payments.upgradeStarGift#aed6e4f5 to nil" )
}
{
if err := u .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.upgradeStarGift#aed6e4f5: field flags: %w" , err )
}
}
u .KeepOriginalDetails = u .Flags .Has (0 )
{
value , err := DecodeInputSavedStarGift (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.upgradeStarGift#aed6e4f5: field stargift: %w" , err )
}
u .Stargift = value
}
return nil
}
func (u *PaymentsUpgradeStarGiftRequest ) SetKeepOriginalDetails (value bool ) {
if value {
u .Flags .Set (0 )
u .KeepOriginalDetails = true
} else {
u .Flags .Unset (0 )
u .KeepOriginalDetails = false
}
}
func (u *PaymentsUpgradeStarGiftRequest ) GetKeepOriginalDetails () (value bool ) {
if u == nil {
return
}
return u .Flags .Has (0 )
}
func (u *PaymentsUpgradeStarGiftRequest ) GetStargift () (value InputSavedStarGiftClass ) {
if u == nil {
return
}
return u .Stargift
}
func (c *Client ) PaymentsUpgradeStarGift (ctx context .Context , request *PaymentsUpgradeStarGiftRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , nil
}
The pages are generated with Golds v0.8.4 . (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 .