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 PaymentsGetPaymentFormRequest struct {
Flags bin .Fields
Invoice InputInvoiceClass
ThemeParams DataJSON
}
const PaymentsGetPaymentFormRequestTypeID = 0x37148dbb
var (
_ bin .Encoder = &PaymentsGetPaymentFormRequest {}
_ bin .Decoder = &PaymentsGetPaymentFormRequest {}
_ bin .BareEncoder = &PaymentsGetPaymentFormRequest {}
_ bin .BareDecoder = &PaymentsGetPaymentFormRequest {}
)
func (g *PaymentsGetPaymentFormRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Invoice == nil ) {
return false
}
if !(g .ThemeParams .Zero ()) {
return false
}
return true
}
func (g *PaymentsGetPaymentFormRequest ) String () string {
if g == nil {
return "PaymentsGetPaymentFormRequest(nil)"
}
type Alias PaymentsGetPaymentFormRequest
return fmt .Sprintf ("PaymentsGetPaymentFormRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetPaymentFormRequest ) FillFrom (from interface {
GetInvoice () (value InputInvoiceClass )
GetThemeParams () (value DataJSON , ok bool )
}) {
g .Invoice = from .GetInvoice ()
if val , ok := from .GetThemeParams (); ok {
g .ThemeParams = val
}
}
func (*PaymentsGetPaymentFormRequest ) TypeID () uint32 {
return PaymentsGetPaymentFormRequestTypeID
}
func (*PaymentsGetPaymentFormRequest ) TypeName () string {
return "payments.getPaymentForm"
}
func (g *PaymentsGetPaymentFormRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getPaymentForm" ,
ID : PaymentsGetPaymentFormRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Invoice" ,
SchemaName : "invoice" ,
},
{
Name : "ThemeParams" ,
SchemaName : "theme_params" ,
Null : !g .Flags .Has (0 ),
},
}
return typ
}
func (g *PaymentsGetPaymentFormRequest ) SetFlags () {
if !(g .ThemeParams .Zero ()) {
g .Flags .Set (0 )
}
}
func (g *PaymentsGetPaymentFormRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getPaymentForm#37148dbb as nil" )
}
b .PutID (PaymentsGetPaymentFormRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetPaymentFormRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getPaymentForm#37148dbb as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getPaymentForm#37148dbb: field flags: %w" , err )
}
if g .Invoice == nil {
return fmt .Errorf ("unable to encode payments.getPaymentForm#37148dbb: field invoice is nil" )
}
if err := g .Invoice .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getPaymentForm#37148dbb: field invoice: %w" , err )
}
if g .Flags .Has (0 ) {
if err := g .ThemeParams .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getPaymentForm#37148dbb: field theme_params: %w" , err )
}
}
return nil
}
func (g *PaymentsGetPaymentFormRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getPaymentForm#37148dbb to nil" )
}
if err := b .ConsumeID (PaymentsGetPaymentFormRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentForm#37148dbb: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetPaymentFormRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getPaymentForm#37148dbb to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentForm#37148dbb: field flags: %w" , err )
}
}
{
value , err := DecodeInputInvoice (b )
if err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentForm#37148dbb: field invoice: %w" , err )
}
g .Invoice = value
}
if g .Flags .Has (0 ) {
if err := g .ThemeParams .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getPaymentForm#37148dbb: field theme_params: %w" , err )
}
}
return nil
}
func (g *PaymentsGetPaymentFormRequest ) GetInvoice () (value InputInvoiceClass ) {
if g == nil {
return
}
return g .Invoice
}
func (g *PaymentsGetPaymentFormRequest ) SetThemeParams (value DataJSON ) {
g .Flags .Set (0 )
g .ThemeParams = value
}
func (g *PaymentsGetPaymentFormRequest ) GetThemeParams () (value DataJSON , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (0 ) {
return value , false
}
return g .ThemeParams , true
}
func (c *Client ) PaymentsGetPaymentForm (ctx context .Context , request *PaymentsGetPaymentFormRequest ) (*PaymentsPaymentForm , error ) {
var result PaymentsPaymentForm
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 .