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 PaymentsGetSavedStarGiftsRequest struct {
Flags bin .Fields
ExcludeUnsaved bool
ExcludeSaved bool
ExcludeUnlimited bool
ExcludeUnique bool
SortByValue bool
ExcludeUpgradable bool
ExcludeUnupgradable bool
PeerColorAvailable bool
ExcludeHosted bool
Peer InputPeerClass
CollectionID int
Offset string
Limit int
}
const PaymentsGetSavedStarGiftsRequestTypeID = 0xa319e569
var (
_ bin .Encoder = &PaymentsGetSavedStarGiftsRequest {}
_ bin .Decoder = &PaymentsGetSavedStarGiftsRequest {}
_ bin .BareEncoder = &PaymentsGetSavedStarGiftsRequest {}
_ bin .BareDecoder = &PaymentsGetSavedStarGiftsRequest {}
)
func (g *PaymentsGetSavedStarGiftsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .ExcludeUnsaved == false ) {
return false
}
if !(g .ExcludeSaved == false ) {
return false
}
if !(g .ExcludeUnlimited == false ) {
return false
}
if !(g .ExcludeUnique == false ) {
return false
}
if !(g .SortByValue == false ) {
return false
}
if !(g .ExcludeUpgradable == false ) {
return false
}
if !(g .ExcludeUnupgradable == false ) {
return false
}
if !(g .PeerColorAvailable == false ) {
return false
}
if !(g .ExcludeHosted == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .CollectionID == 0 ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *PaymentsGetSavedStarGiftsRequest ) String () string {
if g == nil {
return "PaymentsGetSavedStarGiftsRequest(nil)"
}
type Alias PaymentsGetSavedStarGiftsRequest
return fmt .Sprintf ("PaymentsGetSavedStarGiftsRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetSavedStarGiftsRequest ) FillFrom (from interface {
GetExcludeUnsaved () (value bool )
GetExcludeSaved () (value bool )
GetExcludeUnlimited () (value bool )
GetExcludeUnique () (value bool )
GetSortByValue () (value bool )
GetExcludeUpgradable () (value bool )
GetExcludeUnupgradable () (value bool )
GetPeerColorAvailable () (value bool )
GetExcludeHosted () (value bool )
GetPeer () (value InputPeerClass )
GetCollectionID () (value int , ok bool )
GetOffset () (value string )
GetLimit () (value int )
}) {
g .ExcludeUnsaved = from .GetExcludeUnsaved ()
g .ExcludeSaved = from .GetExcludeSaved ()
g .ExcludeUnlimited = from .GetExcludeUnlimited ()
g .ExcludeUnique = from .GetExcludeUnique ()
g .SortByValue = from .GetSortByValue ()
g .ExcludeUpgradable = from .GetExcludeUpgradable ()
g .ExcludeUnupgradable = from .GetExcludeUnupgradable ()
g .PeerColorAvailable = from .GetPeerColorAvailable ()
g .ExcludeHosted = from .GetExcludeHosted ()
g .Peer = from .GetPeer ()
if val , ok := from .GetCollectionID (); ok {
g .CollectionID = val
}
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*PaymentsGetSavedStarGiftsRequest ) TypeID () uint32 {
return PaymentsGetSavedStarGiftsRequestTypeID
}
func (*PaymentsGetSavedStarGiftsRequest ) TypeName () string {
return "payments.getSavedStarGifts"
}
func (g *PaymentsGetSavedStarGiftsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getSavedStarGifts" ,
ID : PaymentsGetSavedStarGiftsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ExcludeUnsaved" ,
SchemaName : "exclude_unsaved" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "ExcludeSaved" ,
SchemaName : "exclude_saved" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "ExcludeUnlimited" ,
SchemaName : "exclude_unlimited" ,
Null : !g .Flags .Has (2 ),
},
{
Name : "ExcludeUnique" ,
SchemaName : "exclude_unique" ,
Null : !g .Flags .Has (4 ),
},
{
Name : "SortByValue" ,
SchemaName : "sort_by_value" ,
Null : !g .Flags .Has (5 ),
},
{
Name : "ExcludeUpgradable" ,
SchemaName : "exclude_upgradable" ,
Null : !g .Flags .Has (7 ),
},
{
Name : "ExcludeUnupgradable" ,
SchemaName : "exclude_unupgradable" ,
Null : !g .Flags .Has (8 ),
},
{
Name : "PeerColorAvailable" ,
SchemaName : "peer_color_available" ,
Null : !g .Flags .Has (9 ),
},
{
Name : "ExcludeHosted" ,
SchemaName : "exclude_hosted" ,
Null : !g .Flags .Has (10 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "CollectionID" ,
SchemaName : "collection_id" ,
Null : !g .Flags .Has (6 ),
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetFlags () {
if !(g .ExcludeUnsaved == false ) {
g .Flags .Set (0 )
}
if !(g .ExcludeSaved == false ) {
g .Flags .Set (1 )
}
if !(g .ExcludeUnlimited == false ) {
g .Flags .Set (2 )
}
if !(g .ExcludeUnique == false ) {
g .Flags .Set (4 )
}
if !(g .SortByValue == false ) {
g .Flags .Set (5 )
}
if !(g .ExcludeUpgradable == false ) {
g .Flags .Set (7 )
}
if !(g .ExcludeUnupgradable == false ) {
g .Flags .Set (8 )
}
if !(g .PeerColorAvailable == false ) {
g .Flags .Set (9 )
}
if !(g .ExcludeHosted == false ) {
g .Flags .Set (10 )
}
if !(g .CollectionID == 0 ) {
g .Flags .Set (6 )
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getSavedStarGifts#a319e569 as nil" )
}
b .PutID (PaymentsGetSavedStarGiftsRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetSavedStarGiftsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getSavedStarGifts#a319e569 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getSavedStarGifts#a319e569: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getSavedStarGifts#a319e569: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getSavedStarGifts#a319e569: field peer: %w" , err )
}
if g .Flags .Has (6 ) {
b .PutInt (g .CollectionID )
}
b .PutString (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *PaymentsGetSavedStarGiftsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getSavedStarGifts#a319e569 to nil" )
}
if err := b .ConsumeID (PaymentsGetSavedStarGiftsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getSavedStarGifts#a319e569: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetSavedStarGiftsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getSavedStarGifts#a319e569 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getSavedStarGifts#a319e569: field flags: %w" , err )
}
}
g .ExcludeUnsaved = g .Flags .Has (0 )
g .ExcludeSaved = g .Flags .Has (1 )
g .ExcludeUnlimited = g .Flags .Has (2 )
g .ExcludeUnique = g .Flags .Has (4 )
g .SortByValue = g .Flags .Has (5 )
g .ExcludeUpgradable = g .Flags .Has (7 )
g .ExcludeUnupgradable = g .Flags .Has (8 )
g .PeerColorAvailable = g .Flags .Has (9 )
g .ExcludeHosted = g .Flags .Has (10 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getSavedStarGifts#a319e569: field peer: %w" , err )
}
g .Peer = value
}
if g .Flags .Has (6 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getSavedStarGifts#a319e569: field collection_id: %w" , err )
}
g .CollectionID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getSavedStarGifts#a319e569: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getSavedStarGifts#a319e569: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeUnsaved (value bool ) {
if value {
g .Flags .Set (0 )
g .ExcludeUnsaved = true
} else {
g .Flags .Unset (0 )
g .ExcludeUnsaved = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeUnsaved () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeSaved (value bool ) {
if value {
g .Flags .Set (1 )
g .ExcludeSaved = true
} else {
g .Flags .Unset (1 )
g .ExcludeSaved = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeSaved () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (1 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeUnlimited (value bool ) {
if value {
g .Flags .Set (2 )
g .ExcludeUnlimited = true
} else {
g .Flags .Unset (2 )
g .ExcludeUnlimited = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeUnlimited () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (2 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeUnique (value bool ) {
if value {
g .Flags .Set (4 )
g .ExcludeUnique = true
} else {
g .Flags .Unset (4 )
g .ExcludeUnique = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeUnique () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (4 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetSortByValue (value bool ) {
if value {
g .Flags .Set (5 )
g .SortByValue = true
} else {
g .Flags .Unset (5 )
g .SortByValue = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetSortByValue () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (5 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeUpgradable (value bool ) {
if value {
g .Flags .Set (7 )
g .ExcludeUpgradable = true
} else {
g .Flags .Unset (7 )
g .ExcludeUpgradable = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeUpgradable () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (7 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeUnupgradable (value bool ) {
if value {
g .Flags .Set (8 )
g .ExcludeUnupgradable = true
} else {
g .Flags .Unset (8 )
g .ExcludeUnupgradable = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeUnupgradable () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (8 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetPeerColorAvailable (value bool ) {
if value {
g .Flags .Set (9 )
g .PeerColorAvailable = true
} else {
g .Flags .Unset (9 )
g .PeerColorAvailable = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetPeerColorAvailable () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (9 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetExcludeHosted (value bool ) {
if value {
g .Flags .Set (10 )
g .ExcludeHosted = true
} else {
g .Flags .Unset (10 )
g .ExcludeHosted = false
}
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetExcludeHosted () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (10 )
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetSavedStarGiftsRequest ) SetCollectionID (value int ) {
g .Flags .Set (6 )
g .CollectionID = value
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetCollectionID () (value int , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (6 ) {
return value , false
}
return g .CollectionID , true
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *PaymentsGetSavedStarGiftsRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) PaymentsGetSavedStarGifts (ctx context .Context , request *PaymentsGetSavedStarGiftsRequest ) (*PaymentsSavedStarGifts , error ) {
var result PaymentsSavedStarGifts
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , 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 .