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 FragmentCollectibleInfo struct {
PurchaseDate int
Currency string
Amount int64
CryptoCurrency string
CryptoAmount int64
URL string
}
const FragmentCollectibleInfoTypeID = 0x6ebdff91
var (
_ bin .Encoder = &FragmentCollectibleInfo {}
_ bin .Decoder = &FragmentCollectibleInfo {}
_ bin .BareEncoder = &FragmentCollectibleInfo {}
_ bin .BareDecoder = &FragmentCollectibleInfo {}
)
func (c *FragmentCollectibleInfo ) Zero () bool {
if c == nil {
return true
}
if !(c .PurchaseDate == 0 ) {
return false
}
if !(c .Currency == "" ) {
return false
}
if !(c .Amount == 0 ) {
return false
}
if !(c .CryptoCurrency == "" ) {
return false
}
if !(c .CryptoAmount == 0 ) {
return false
}
if !(c .URL == "" ) {
return false
}
return true
}
func (c *FragmentCollectibleInfo ) String () string {
if c == nil {
return "FragmentCollectibleInfo(nil)"
}
type Alias FragmentCollectibleInfo
return fmt .Sprintf ("FragmentCollectibleInfo%+v" , Alias (*c ))
}
func (c *FragmentCollectibleInfo ) FillFrom (from interface {
GetPurchaseDate () (value int )
GetCurrency () (value string )
GetAmount () (value int64 )
GetCryptoCurrency () (value string )
GetCryptoAmount () (value int64 )
GetURL () (value string )
}) {
c .PurchaseDate = from .GetPurchaseDate ()
c .Currency = from .GetCurrency ()
c .Amount = from .GetAmount ()
c .CryptoCurrency = from .GetCryptoCurrency ()
c .CryptoAmount = from .GetCryptoAmount ()
c .URL = from .GetURL ()
}
func (*FragmentCollectibleInfo ) TypeID () uint32 {
return FragmentCollectibleInfoTypeID
}
func (*FragmentCollectibleInfo ) TypeName () string {
return "fragment.collectibleInfo"
}
func (c *FragmentCollectibleInfo ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "fragment.collectibleInfo" ,
ID : FragmentCollectibleInfoTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PurchaseDate" ,
SchemaName : "purchase_date" ,
},
{
Name : "Currency" ,
SchemaName : "currency" ,
},
{
Name : "Amount" ,
SchemaName : "amount" ,
},
{
Name : "CryptoCurrency" ,
SchemaName : "crypto_currency" ,
},
{
Name : "CryptoAmount" ,
SchemaName : "crypto_amount" ,
},
{
Name : "URL" ,
SchemaName : "url" ,
},
}
return typ
}
func (c *FragmentCollectibleInfo ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode fragment.collectibleInfo#6ebdff91 as nil" )
}
b .PutID (FragmentCollectibleInfoTypeID )
return c .EncodeBare (b )
}
func (c *FragmentCollectibleInfo ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode fragment.collectibleInfo#6ebdff91 as nil" )
}
b .PutInt (c .PurchaseDate )
b .PutString (c .Currency )
b .PutLong (c .Amount )
b .PutString (c .CryptoCurrency )
b .PutLong (c .CryptoAmount )
b .PutString (c .URL )
return nil
}
func (c *FragmentCollectibleInfo ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode fragment.collectibleInfo#6ebdff91 to nil" )
}
if err := b .ConsumeID (FragmentCollectibleInfoTypeID ); err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: %w" , err )
}
return c .DecodeBare (b )
}
func (c *FragmentCollectibleInfo ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode fragment.collectibleInfo#6ebdff91 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: field purchase_date: %w" , err )
}
c .PurchaseDate = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: field currency: %w" , err )
}
c .Currency = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: field amount: %w" , err )
}
c .Amount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: field crypto_currency: %w" , err )
}
c .CryptoCurrency = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: field crypto_amount: %w" , err )
}
c .CryptoAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode fragment.collectibleInfo#6ebdff91: field url: %w" , err )
}
c .URL = value
}
return nil
}
func (c *FragmentCollectibleInfo ) GetPurchaseDate () (value int ) {
if c == nil {
return
}
return c .PurchaseDate
}
func (c *FragmentCollectibleInfo ) GetCurrency () (value string ) {
if c == nil {
return
}
return c .Currency
}
func (c *FragmentCollectibleInfo ) GetAmount () (value int64 ) {
if c == nil {
return
}
return c .Amount
}
func (c *FragmentCollectibleInfo ) GetCryptoCurrency () (value string ) {
if c == nil {
return
}
return c .CryptoCurrency
}
func (c *FragmentCollectibleInfo ) GetCryptoAmount () (value int64 ) {
if c == nil {
return
}
return c .CryptoAmount
}
func (c *FragmentCollectibleInfo ) GetURL () (value string ) {
if c == nil {
return
}
return c .URL
}
The pages are generated with Golds v0.8.4 . (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 .