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 OnrampQuote struct {
BaseCurrency string
BaseAmount string
CryptoCurrency string
CryptoAmount string
CryptoPrice string
FeeAmount string
ExtraFeeAmount string
NetworkFeeAmount string
TotalAmount string
PaymentMethod string
ExpiresDate int
}
const OnrampQuoteTypeID = 0x7a8011e9
var (
_ bin .Encoder = &OnrampQuote {}
_ bin .Decoder = &OnrampQuote {}
_ bin .BareEncoder = &OnrampQuote {}
_ bin .BareDecoder = &OnrampQuote {}
)
func (o *OnrampQuote ) Zero () bool {
if o == nil {
return true
}
if !(o .BaseCurrency == "" ) {
return false
}
if !(o .BaseAmount == "" ) {
return false
}
if !(o .CryptoCurrency == "" ) {
return false
}
if !(o .CryptoAmount == "" ) {
return false
}
if !(o .CryptoPrice == "" ) {
return false
}
if !(o .FeeAmount == "" ) {
return false
}
if !(o .ExtraFeeAmount == "" ) {
return false
}
if !(o .NetworkFeeAmount == "" ) {
return false
}
if !(o .TotalAmount == "" ) {
return false
}
if !(o .PaymentMethod == "" ) {
return false
}
if !(o .ExpiresDate == 0 ) {
return false
}
return true
}
func (o *OnrampQuote ) String () string {
if o == nil {
return "OnrampQuote(nil)"
}
type Alias OnrampQuote
return fmt .Sprintf ("OnrampQuote%+v" , Alias (*o ))
}
func (o *OnrampQuote ) FillFrom (from interface {
GetBaseCurrency () (value string )
GetBaseAmount () (value string )
GetCryptoCurrency () (value string )
GetCryptoAmount () (value string )
GetCryptoPrice () (value string )
GetFeeAmount () (value string )
GetExtraFeeAmount () (value string )
GetNetworkFeeAmount () (value string )
GetTotalAmount () (value string )
GetPaymentMethod () (value string )
GetExpiresDate () (value int )
}) {
o .BaseCurrency = from .GetBaseCurrency ()
o .BaseAmount = from .GetBaseAmount ()
o .CryptoCurrency = from .GetCryptoCurrency ()
o .CryptoAmount = from .GetCryptoAmount ()
o .CryptoPrice = from .GetCryptoPrice ()
o .FeeAmount = from .GetFeeAmount ()
o .ExtraFeeAmount = from .GetExtraFeeAmount ()
o .NetworkFeeAmount = from .GetNetworkFeeAmount ()
o .TotalAmount = from .GetTotalAmount ()
o .PaymentMethod = from .GetPaymentMethod ()
o .ExpiresDate = from .GetExpiresDate ()
}
func (*OnrampQuote ) TypeID () uint32 {
return OnrampQuoteTypeID
}
func (*OnrampQuote ) TypeName () string {
return "onrampQuote"
}
func (o *OnrampQuote ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "onrampQuote" ,
ID : OnrampQuoteTypeID ,
}
if o == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "BaseCurrency" ,
SchemaName : "base_currency" ,
},
{
Name : "BaseAmount" ,
SchemaName : "base_amount" ,
},
{
Name : "CryptoCurrency" ,
SchemaName : "crypto_currency" ,
},
{
Name : "CryptoAmount" ,
SchemaName : "crypto_amount" ,
},
{
Name : "CryptoPrice" ,
SchemaName : "crypto_price" ,
},
{
Name : "FeeAmount" ,
SchemaName : "fee_amount" ,
},
{
Name : "ExtraFeeAmount" ,
SchemaName : "extra_fee_amount" ,
},
{
Name : "NetworkFeeAmount" ,
SchemaName : "network_fee_amount" ,
},
{
Name : "TotalAmount" ,
SchemaName : "total_amount" ,
},
{
Name : "PaymentMethod" ,
SchemaName : "payment_method" ,
},
{
Name : "ExpiresDate" ,
SchemaName : "expires_date" ,
},
}
return typ
}
func (o *OnrampQuote ) Encode (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't encode onrampQuote#7a8011e9 as nil" )
}
b .PutID (OnrampQuoteTypeID )
return o .EncodeBare (b )
}
func (o *OnrampQuote ) EncodeBare (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't encode onrampQuote#7a8011e9 as nil" )
}
b .PutString (o .BaseCurrency )
b .PutString (o .BaseAmount )
b .PutString (o .CryptoCurrency )
b .PutString (o .CryptoAmount )
b .PutString (o .CryptoPrice )
b .PutString (o .FeeAmount )
b .PutString (o .ExtraFeeAmount )
b .PutString (o .NetworkFeeAmount )
b .PutString (o .TotalAmount )
b .PutString (o .PaymentMethod )
b .PutInt (o .ExpiresDate )
return nil
}
func (o *OnrampQuote ) Decode (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't decode onrampQuote#7a8011e9 to nil" )
}
if err := b .ConsumeID (OnrampQuoteTypeID ); err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: %w" , err )
}
return o .DecodeBare (b )
}
func (o *OnrampQuote ) DecodeBare (b *bin .Buffer ) error {
if o == nil {
return fmt .Errorf ("can't decode onrampQuote#7a8011e9 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field base_currency: %w" , err )
}
o .BaseCurrency = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field base_amount: %w" , err )
}
o .BaseAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field crypto_currency: %w" , err )
}
o .CryptoCurrency = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field crypto_amount: %w" , err )
}
o .CryptoAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field crypto_price: %w" , err )
}
o .CryptoPrice = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field fee_amount: %w" , err )
}
o .FeeAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field extra_fee_amount: %w" , err )
}
o .ExtraFeeAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field network_fee_amount: %w" , err )
}
o .NetworkFeeAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field total_amount: %w" , err )
}
o .TotalAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field payment_method: %w" , err )
}
o .PaymentMethod = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode onrampQuote#7a8011e9: field expires_date: %w" , err )
}
o .ExpiresDate = value
}
return nil
}
func (o *OnrampQuote ) GetBaseCurrency () (value string ) {
if o == nil {
return
}
return o .BaseCurrency
}
func (o *OnrampQuote ) GetBaseAmount () (value string ) {
if o == nil {
return
}
return o .BaseAmount
}
func (o *OnrampQuote ) GetCryptoCurrency () (value string ) {
if o == nil {
return
}
return o .CryptoCurrency
}
func (o *OnrampQuote ) GetCryptoAmount () (value string ) {
if o == nil {
return
}
return o .CryptoAmount
}
func (o *OnrampQuote ) GetCryptoPrice () (value string ) {
if o == nil {
return
}
return o .CryptoPrice
}
func (o *OnrampQuote ) GetFeeAmount () (value string ) {
if o == nil {
return
}
return o .FeeAmount
}
func (o *OnrampQuote ) GetExtraFeeAmount () (value string ) {
if o == nil {
return
}
return o .ExtraFeeAmount
}
func (o *OnrampQuote ) GetNetworkFeeAmount () (value string ) {
if o == nil {
return
}
return o .NetworkFeeAmount
}
func (o *OnrampQuote ) GetTotalAmount () (value string ) {
if o == nil {
return
}
return o .TotalAmount
}
func (o *OnrampQuote ) GetPaymentMethod () (value string ) {
if o == nil {
return
}
return o .PaymentMethod
}
func (o *OnrampQuote ) GetExpiresDate () (value int ) {
if o == nil {
return
}
return o .ExpiresDate
}
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 .