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 PaymentsGetBankCardDataRequest struct {
Number string
}
const PaymentsGetBankCardDataRequestTypeID = 0x2e79d779
var (
_ bin .Encoder = &PaymentsGetBankCardDataRequest {}
_ bin .Decoder = &PaymentsGetBankCardDataRequest {}
_ bin .BareEncoder = &PaymentsGetBankCardDataRequest {}
_ bin .BareDecoder = &PaymentsGetBankCardDataRequest {}
)
func (g *PaymentsGetBankCardDataRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Number == "" ) {
return false
}
return true
}
func (g *PaymentsGetBankCardDataRequest ) String () string {
if g == nil {
return "PaymentsGetBankCardDataRequest(nil)"
}
type Alias PaymentsGetBankCardDataRequest
return fmt .Sprintf ("PaymentsGetBankCardDataRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetBankCardDataRequest ) FillFrom (from interface {
GetNumber () (value string )
}) {
g .Number = from .GetNumber ()
}
func (*PaymentsGetBankCardDataRequest ) TypeID () uint32 {
return PaymentsGetBankCardDataRequestTypeID
}
func (*PaymentsGetBankCardDataRequest ) TypeName () string {
return "payments.getBankCardData"
}
func (g *PaymentsGetBankCardDataRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getBankCardData" ,
ID : PaymentsGetBankCardDataRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Number" ,
SchemaName : "number" ,
},
}
return typ
}
func (g *PaymentsGetBankCardDataRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getBankCardData#2e79d779 as nil" )
}
b .PutID (PaymentsGetBankCardDataRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetBankCardDataRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getBankCardData#2e79d779 as nil" )
}
b .PutString (g .Number )
return nil
}
func (g *PaymentsGetBankCardDataRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getBankCardData#2e79d779 to nil" )
}
if err := b .ConsumeID (PaymentsGetBankCardDataRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getBankCardData#2e79d779: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetBankCardDataRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getBankCardData#2e79d779 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getBankCardData#2e79d779: field number: %w" , err )
}
g .Number = value
}
return nil
}
func (g *PaymentsGetBankCardDataRequest ) GetNumber () (value string ) {
if g == nil {
return
}
return g .Number
}
func (c *Client ) PaymentsGetBankCardData (ctx context .Context , number string ) (*PaymentsBankCardData , error ) {
var result PaymentsBankCardData
request := &PaymentsGetBankCardDataRequest {
Number : number ,
}
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 .