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 PaymentsGetOnrampBaseCurrenciesRequest struct {
Provider string
CryptoCurrency string
}
const PaymentsGetOnrampBaseCurrenciesRequestTypeID = 0x1c8bedf3
var (
_ bin .Encoder = &PaymentsGetOnrampBaseCurrenciesRequest {}
_ bin .Decoder = &PaymentsGetOnrampBaseCurrenciesRequest {}
_ bin .BareEncoder = &PaymentsGetOnrampBaseCurrenciesRequest {}
_ bin .BareDecoder = &PaymentsGetOnrampBaseCurrenciesRequest {}
)
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Provider == "" ) {
return false
}
if !(g .CryptoCurrency == "" ) {
return false
}
return true
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) String () string {
if g == nil {
return "PaymentsGetOnrampBaseCurrenciesRequest(nil)"
}
type Alias PaymentsGetOnrampBaseCurrenciesRequest
return fmt .Sprintf ("PaymentsGetOnrampBaseCurrenciesRequest%+v" , Alias (*g ))
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) FillFrom (from interface {
GetProvider () (value string )
GetCryptoCurrency () (value string )
}) {
g .Provider = from .GetProvider ()
g .CryptoCurrency = from .GetCryptoCurrency ()
}
func (*PaymentsGetOnrampBaseCurrenciesRequest ) TypeID () uint32 {
return PaymentsGetOnrampBaseCurrenciesRequestTypeID
}
func (*PaymentsGetOnrampBaseCurrenciesRequest ) TypeName () string {
return "payments.getOnrampBaseCurrencies"
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "payments.getOnrampBaseCurrencies" ,
ID : PaymentsGetOnrampBaseCurrenciesRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Provider" ,
SchemaName : "provider" ,
},
{
Name : "CryptoCurrency" ,
SchemaName : "crypto_currency" ,
},
}
return typ
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getOnrampBaseCurrencies#1c8bedf3 as nil" )
}
b .PutID (PaymentsGetOnrampBaseCurrenciesRequestTypeID )
return g .EncodeBare (b )
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode payments.getOnrampBaseCurrencies#1c8bedf3 as nil" )
}
b .PutString (g .Provider )
b .PutString (g .CryptoCurrency )
return nil
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getOnrampBaseCurrencies#1c8bedf3 to nil" )
}
if err := b .ConsumeID (PaymentsGetOnrampBaseCurrenciesRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampBaseCurrencies#1c8bedf3: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode payments.getOnrampBaseCurrencies#1c8bedf3 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampBaseCurrencies#1c8bedf3: field provider: %w" , err )
}
g .Provider = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode payments.getOnrampBaseCurrencies#1c8bedf3: field crypto_currency: %w" , err )
}
g .CryptoCurrency = value
}
return nil
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) GetProvider () (value string ) {
if g == nil {
return
}
return g .Provider
}
func (g *PaymentsGetOnrampBaseCurrenciesRequest ) GetCryptoCurrency () (value string ) {
if g == nil {
return
}
return g .CryptoCurrency
}
func (c *Client ) PaymentsGetOnrampBaseCurrencies (ctx context .Context , request *PaymentsGetOnrampBaseCurrenciesRequest ) ([]string , error ) {
var result StringVector
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return []string (result .Elems ), 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 .