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 PaymentsGetStarsSubscriptionsRequest struct {
Flags bin .Fields
MissingBalance bool
Peer InputPeerClass
Offset string
}
const PaymentsGetStarsSubscriptionsRequestTypeID = 0x32512c5
var (
_ bin .Encoder = &PaymentsGetStarsSubscriptionsRequest {}
_ bin .Decoder = &PaymentsGetStarsSubscriptionsRequest {}
_ bin .BareEncoder = &PaymentsGetStarsSubscriptionsRequest {}
_ bin .BareDecoder = &PaymentsGetStarsSubscriptionsRequest {}
)
func (g *PaymentsGetStarsSubscriptionsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .MissingBalance == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .Offset == "" ) {
return false
}
return true
}
func (g *PaymentsGetStarsSubscriptionsRequest ) String () string {
if g == nil {
return "PaymentsGetStarsSubscriptionsRequest(nil)"
}
type Alias PaymentsGetStarsSubscriptionsRequest
return fmt .Sprintf ("PaymentsGetStarsSubscriptionsRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetStarsSubscriptionsRequest ) FillFrom (from interface {
GetMissingBalance () (value bool )
GetPeer () (value InputPeerClass )
GetOffset () (value string )
}) {
g .MissingBalance = from .GetMissingBalance ()
g .Peer = from .GetPeer ()
g .Offset = from .GetOffset ()
}
func (*PaymentsGetStarsSubscriptionsRequest ) TypeID () uint32 {
return PaymentsGetStarsSubscriptionsRequestTypeID
}
func (*PaymentsGetStarsSubscriptionsRequest ) TypeName () string {
return "payments.getStarsSubscriptions"
}
func (g *PaymentsGetStarsSubscriptionsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getStarsSubscriptions" ,
ID : PaymentsGetStarsSubscriptionsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MissingBalance" ,
SchemaName : "missing_balance" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
}
return typ
}
func (g *PaymentsGetStarsSubscriptionsRequest ) SetFlags () {
if !(g .MissingBalance == false ) {
g .Flags .Set (0 )
}
}
func (g *PaymentsGetStarsSubscriptionsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarsSubscriptions#32512c5 as nil" )
}
b .PutID (PaymentsGetStarsSubscriptionsRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetStarsSubscriptionsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarsSubscriptions#32512c5 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsSubscriptions#32512c5: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getStarsSubscriptions#32512c5: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsSubscriptions#32512c5: field peer: %w" , err )
}
b .PutString (g .Offset )
return nil
}
func (g *PaymentsGetStarsSubscriptionsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarsSubscriptions#32512c5 to nil" )
}
if err := b .ConsumeID (PaymentsGetStarsSubscriptionsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsSubscriptions#32512c5: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetStarsSubscriptionsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarsSubscriptions#32512c5 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsSubscriptions#32512c5: field flags: %w" , err )
}
}
g .MissingBalance = g .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsSubscriptions#32512c5: field peer: %w" , err )
}
g .Peer = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsSubscriptions#32512c5: field offset: %w" , err )
}
g .Offset = value
}
return nil
}
func (g *PaymentsGetStarsSubscriptionsRequest ) SetMissingBalance (value bool ) {
if value {
g .Flags .Set (0 )
g .MissingBalance = true
} else {
g .Flags .Unset (0 )
g .MissingBalance = false
}
}
func (g *PaymentsGetStarsSubscriptionsRequest ) GetMissingBalance () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *PaymentsGetStarsSubscriptionsRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetStarsSubscriptionsRequest ) GetOffset () (value string ) {
if g == nil {
return
}
return g .Offset
}
func (c *Client ) PaymentsGetStarsSubscriptions (ctx context .Context , request *PaymentsGetStarsSubscriptionsRequest ) (*PaymentsStarsStatus , error ) {
var result PaymentsStarsStatus
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 .