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 PaymentsGetOnrampLimitsRequest struct {
Flags bin .Fields
Provider string
CryptoCurrency string
BaseCurrency string
PaymentMethod string
}
const PaymentsGetOnrampLimitsRequestTypeID = 0x80e851fd
var (
_ bin .Encoder = &PaymentsGetOnrampLimitsRequest {}
_ bin .Decoder = &PaymentsGetOnrampLimitsRequest {}
_ bin .BareEncoder = &PaymentsGetOnrampLimitsRequest {}
_ bin .BareDecoder = &PaymentsGetOnrampLimitsRequest {}
)
func (g *PaymentsGetOnrampLimitsRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .Provider == "" ) {
return false
}
if !(g .CryptoCurrency == "" ) {
return false
}
if !(g .BaseCurrency == "" ) {
return false
}
if !(g .PaymentMethod == "" ) {
return false
}
return true
}
func (g *PaymentsGetOnrampLimitsRequest ) String () string {
if g == nil {
return "PaymentsGetOnrampLimitsRequest(nil)"
}
type Alias PaymentsGetOnrampLimitsRequest
return fmt .Sprintf ("PaymentsGetOnrampLimitsRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetOnrampLimitsRequest ) FillFrom (from interface {
GetProvider () (value string )
GetCryptoCurrency () (value string )
GetBaseCurrency () (value string )
GetPaymentMethod () (value string , ok bool )
}) {
g .Provider = from .GetProvider ()
g .CryptoCurrency = from .GetCryptoCurrency ()
g .BaseCurrency = from .GetBaseCurrency ()
if val , ok := from .GetPaymentMethod (); ok {
g .PaymentMethod = val
}
}
func (*PaymentsGetOnrampLimitsRequest ) TypeID () uint32 {
return PaymentsGetOnrampLimitsRequestTypeID
}
func (*PaymentsGetOnrampLimitsRequest ) TypeName () string {
return "payments.getOnrampLimits"
}
func (g *PaymentsGetOnrampLimitsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getOnrampLimits" ,
ID : PaymentsGetOnrampLimitsRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Provider" ,
SchemaName : "provider" ,
},
{
Name : "CryptoCurrency" ,
SchemaName : "crypto_currency" ,
},
{
Name : "BaseCurrency" ,
SchemaName : "base_currency" ,
},
{
Name : "PaymentMethod" ,
SchemaName : "payment_method" ,
Null : !g .Flags .Has (0 ),
},
}
return typ
}
func (g *PaymentsGetOnrampLimitsRequest ) SetFlags () {
if !(g .PaymentMethod == "" ) {
g .Flags .Set (0 )
}
}
func (g *PaymentsGetOnrampLimitsRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getOnrampLimits#80e851fd as nil" )
}
b .PutID (PaymentsGetOnrampLimitsRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetOnrampLimitsRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getOnrampLimits#80e851fd as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode payments.getOnrampLimits#80e851fd: field flags: %w" , err )
}
b .PutString (g .Provider )
b .PutString (g .CryptoCurrency )
b .PutString (g .BaseCurrency )
if g .Flags .Has (0 ) {
b .PutString (g .PaymentMethod )
}
return nil
}
func (g *PaymentsGetOnrampLimitsRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getOnrampLimits#80e851fd to nil" )
}
if err := b .ConsumeID (PaymentsGetOnrampLimitsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampLimits#80e851fd: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetOnrampLimitsRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getOnrampLimits#80e851fd to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampLimits#80e851fd: field flags: %w" , err )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampLimits#80e851fd: field provider: %w" , err )
}
g .Provider = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampLimits#80e851fd: field crypto_currency: %w" , err )
}
g .CryptoCurrency = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampLimits#80e851fd: field base_currency: %w" , err )
}
g .BaseCurrency = value
}
if g .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampLimits#80e851fd: field payment_method: %w" , err )
}
g .PaymentMethod = value
}
return nil
}
func (g *PaymentsGetOnrampLimitsRequest ) GetProvider () (value string ) {
if g == nil {
return
}
return g .Provider
}
func (g *PaymentsGetOnrampLimitsRequest ) GetCryptoCurrency () (value string ) {
if g == nil {
return
}
return g .CryptoCurrency
}
func (g *PaymentsGetOnrampLimitsRequest ) GetBaseCurrency () (value string ) {
if g == nil {
return
}
return g .BaseCurrency
}
func (g *PaymentsGetOnrampLimitsRequest ) SetPaymentMethod (value string ) {
g .Flags .Set (0 )
g .PaymentMethod = value
}
func (g *PaymentsGetOnrampLimitsRequest ) GetPaymentMethod () (value string , ok bool ) {
if g == nil {
return
}
if !g .Flags .Has (0 ) {
return value , false
}
return g .PaymentMethod , true
}
func (c *Client ) PaymentsGetOnrampLimits (ctx context .Context , request *PaymentsGetOnrampLimitsRequest ) (*OnrampLimits , error ) {
var result OnrampLimits
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return &result , nil
}
The pages are generated with Golds v0.8.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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .