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 PremiumGetBoostsListRequest struct {
Flags bin .Fields
Gifts bool
Peer InputPeerClass
Offset string
Limit int
}
const PremiumGetBoostsListRequestTypeID = 0x60f67660
var (
_ bin .Encoder = &PremiumGetBoostsListRequest {}
_ bin .Decoder = &PremiumGetBoostsListRequest {}
_ bin .BareEncoder = &PremiumGetBoostsListRequest {}
_ bin .BareDecoder = &PremiumGetBoostsListRequest {}
)
func (g *PremiumGetBoostsListRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Gifts == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .Offset == "" ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *PremiumGetBoostsListRequest ) String () string {
if g == nil {
return "PremiumGetBoostsListRequest(nil)"
}
type Alias PremiumGetBoostsListRequest
return fmt .Sprintf ("PremiumGetBoostsListRequest%+v" , Alias (*g ))
}
func (g *PremiumGetBoostsListRequest ) FillFrom (from interface {
GetGifts () (value bool )
GetPeer () (value InputPeerClass )
GetOffset () (value string )
GetLimit () (value int )
}) {
g .Gifts = from .GetGifts ()
g .Peer = from .GetPeer ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*PremiumGetBoostsListRequest ) TypeID () uint32 {
return PremiumGetBoostsListRequestTypeID
}
func (*PremiumGetBoostsListRequest ) TypeName () string {
return "premium.getBoostsList"
}
func (g *PremiumGetBoostsListRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "premium.getBoostsList" ,
ID : PremiumGetBoostsListRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Gifts" ,
SchemaName : "gifts" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *PremiumGetBoostsListRequest ) SetFlags () {
if !(g .Gifts == false ) {
g .Flags .Set (0 )
}
}
func (g *PremiumGetBoostsListRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode premium.getBoostsList#60f67660 as nil" )
}
b .PutID (PremiumGetBoostsListRequestTypeID )
return g .EncodeBare (b )
}
func (g *PremiumGetBoostsListRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode premium.getBoostsList#60f67660 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode premium.getBoostsList#60f67660: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode premium.getBoostsList#60f67660: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode premium.getBoostsList#60f67660: field peer: %w" , err )
}
b .PutString (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *PremiumGetBoostsListRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode premium.getBoostsList#60f67660 to nil" )
}
if err := b .ConsumeID (PremiumGetBoostsListRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode premium.getBoostsList#60f67660: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PremiumGetBoostsListRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode premium.getBoostsList#60f67660 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode premium.getBoostsList#60f67660: field flags: %w" , err )
}
}
g .Gifts = g .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode premium.getBoostsList#60f67660: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode premium.getBoostsList#60f67660: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode premium.getBoostsList#60f67660: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *PremiumGetBoostsListRequest ) SetGifts (value bool ) {
if value {
g .Flags .Set (0 )
g .Gifts = true
} else {
g .Flags .Unset (0 )
g .Gifts = false
}
}
func (g *PremiumGetBoostsListRequest ) GetGifts () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *PremiumGetBoostsListRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PremiumGetBoostsListRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (g *PremiumGetBoostsListRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) PremiumGetBoostsList (ctx context .Context , request *PremiumGetBoostsListRequest ) (*PremiumBoostsList , error ) {
var result PremiumBoostsList
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
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 .