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 PaymentsGetStarsRevenueWithdrawalURLRequest struct {
Flags bin .Fields
Ton bool
Peer InputPeerClass
Amount int64
Password InputCheckPasswordSRPClass
}
const PaymentsGetStarsRevenueWithdrawalURLRequestTypeID = 0x2433dc92
var (
_ bin .Encoder = &PaymentsGetStarsRevenueWithdrawalURLRequest {}
_ bin .Decoder = &PaymentsGetStarsRevenueWithdrawalURLRequest {}
_ bin .BareEncoder = &PaymentsGetStarsRevenueWithdrawalURLRequest {}
_ bin .BareDecoder = &PaymentsGetStarsRevenueWithdrawalURLRequest {}
)
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Ton == false ) {
return false
}
if !(g .Peer == nil ) {
return false
}
if !(g .Amount == 0 ) {
return false
}
if !(g .Password == nil ) {
return false
}
return true
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) String () string {
if g == nil {
return "PaymentsGetStarsRevenueWithdrawalURLRequest(nil)"
}
type Alias PaymentsGetStarsRevenueWithdrawalURLRequest
return fmt .Sprintf ("PaymentsGetStarsRevenueWithdrawalURLRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) FillFrom (from interface {
GetTon () (value bool )
GetPeer () (value InputPeerClass )
GetAmount () (value int64 , ok bool )
GetPassword () (value InputCheckPasswordSRPClass )
}) {
g .Ton = from .GetTon ()
g .Peer = from .GetPeer ()
if val , ok := from .GetAmount (); ok {
g .Amount = val
}
g .Password = from .GetPassword ()
}
func (*PaymentsGetStarsRevenueWithdrawalURLRequest ) TypeID () uint32 {
return PaymentsGetStarsRevenueWithdrawalURLRequestTypeID
}
func (*PaymentsGetStarsRevenueWithdrawalURLRequest ) TypeName () string {
return "payments.getStarsRevenueWithdrawalUrl"
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getStarsRevenueWithdrawalUrl" ,
ID : PaymentsGetStarsRevenueWithdrawalURLRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Ton" ,
SchemaName : "ton" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Amount" ,
SchemaName : "amount" ,
Null : !g .Flags .Has (1 ),
},
{
Name : "Password" ,
SchemaName : "password" ,
},
}
return typ
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) SetFlags () {
if !(g .Ton == false ) {
g .Flags .Set (0 )
}
if !(g .Amount == 0 ) {
g .Flags .Set (1 )
}
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarsRevenueWithdrawalUrl#2433dc92 as nil" )
}
b .PutID (PaymentsGetStarsRevenueWithdrawalURLRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getStarsRevenueWithdrawalUrl#2433dc92 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsRevenueWithdrawalUrl#2433dc92: field flags: %w" , err )
}
if g .Peer == nil {
return fmt .Errorf ("unable to encode payments.getStarsRevenueWithdrawalUrl#2433dc92: field peer is nil" )
}
if err := g .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsRevenueWithdrawalUrl#2433dc92: field peer: %w" , err )
}
if g .Flags .Has (1 ) {
b .PutLong (g .Amount )
}
if g .Password == nil {
return fmt .Errorf ("unable to encode payments.getStarsRevenueWithdrawalUrl#2433dc92: field password is nil" )
}
if err := g .Password .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getStarsRevenueWithdrawalUrl#2433dc92: field password: %w" , err )
}
return nil
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarsRevenueWithdrawalUrl#2433dc92 to nil" )
}
if err := b .ConsumeID (PaymentsGetStarsRevenueWithdrawalURLRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsRevenueWithdrawalUrl#2433dc92: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getStarsRevenueWithdrawalUrl#2433dc92 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getStarsRevenueWithdrawalUrl#2433dc92: field flags: %w" , err )
}
}
g .Ton = g .Flags .Has (0 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsRevenueWithdrawalUrl#2433dc92: field peer: %w" , err )
}
g .Peer = value
}
if g .Flags .Has (1 ) {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsRevenueWithdrawalUrl#2433dc92: field amount: %w" , err )
}
g .Amount = value
}
{
value , err := DecodeInputCheckPasswordSRP (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getStarsRevenueWithdrawalUrl#2433dc92: field password: %w" , err )
}
g .Password = value
}
return nil
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) SetTon (value bool ) {
if value {
g .Flags .Set (0 )
g .Ton = true
} else {
g .Flags .Unset (0 )
g .Ton = false
}
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) GetTon () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) GetPeer () (value InputPeerClass ) {
if g == nil {
return
}
return g .Peer
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) SetAmount (value int64 ) {
g .Flags .Set (1 )
g .Amount = value
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) GetAmount () (value int64 , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (1 ) {
return value , false
}
return g .Amount , true
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) GetPassword () (value InputCheckPasswordSRPClass ) {
if g == nil {
return
}
return g .Password
}
func (g *PaymentsGetStarsRevenueWithdrawalURLRequest ) GetPasswordAsNotEmpty () (*InputCheckPasswordSRP , bool ) {
return g .Password .AsNotEmpty ()
}
func (c *Client ) PaymentsGetStarsRevenueWithdrawalURL (ctx context .Context , request *PaymentsGetStarsRevenueWithdrawalURLRequest ) (*PaymentsStarsRevenueWithdrawalURL , error ) {
var result PaymentsStarsRevenueWithdrawalURL
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 .